[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Memory corruption in kfontdialog?
From:       Dave Corrie <kde () davecorrie ! com>
Date:       2002-07-31 20:59:25
[Download RAW message or body]

Hi,

When I do "kcmshell fonts" to edit my fonts and go to change a font that 
has a bold + italic style, the font chooser dialog does not always 
choose "Bold Italic" as the initial style. Editing a bold italic Arial 
font sometimes works, but editing a bold italic Trebuchet font never 
seems to (although this phenomena is not restricted to MS fonts).

I stepped through the kfontdialog code to figure out what was going on, 
because the font dialog is passed the correct font to show initially, 
it just doesn't always show it. With the attached patch applied (it 
just adds some output info), the style of the font "magically" changes 
after the (seemingly unrelated) call to setCurrentItem().

I presume there's some sort of pointer abuse going, but I don't see 
anything relevant in the valgrind output. I fixed some uninitialised 
variables in the kfontdialog code, but this made no difference. Can 
anyone see the problem?

-- 
Dave




["fontdebug.patch" (text/x-diff)]

Index: kfontdialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kfontdialog.cpp,v
retrieving revision 1.91
diff -u -3 -p -r1.91 kfontdialog.cpp
--- kfontdialog.cpp	2002/07/31 20:44:23	1.91
+++ kfontdialog.cpp	2002/07/31 20:47:48
@@ -572,7 +572,15 @@ void KFontChooser::setupDisplay()
 
   for (i = 0; i < numEntries; i++) {
     if (aString.lower() == (familyListBox->text(i).lower())) {
+
+      QString s = selFont.bold()?(selFont.italic()?" Bold Italic ":" Bold \
"):(selFont.italic()?" Italic ":" Regular "); +      kdDebug() << selFont.family() << \
s << selFont.pointSize() << endl; +
       familyListBox->setCurrentItem(i);
+
+      s = selFont.bold()?(selFont.italic()?" Bold Italic ":" Bold \
"):(selFont.italic()?" Italic ":" Regular "); +      kdDebug() << selFont.family() << \
s << selFont.pointSize() << endl; +
       break;
     }
   }



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic