Bug 82877 - kpdf crashes when zooming to 12.5. 33.33 and 66.67 per cent
Summary: kpdf crashes when zooming to 12.5. 33.33 and 66.67 per cent
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Christophe Devriese
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-05 13:20 UTC by Arnout Boelens
Modified: 2004-09-02 20:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch to Kpdf part (1.33 KB, patch)
2004-08-31 20:47 UTC, Antti Markus
Details
Fixes crash, uses locale decimal symbol for zoom values (1.43 KB, patch)
2004-08-31 23:44 UTC, Antti Markus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arnout Boelens 2004-06-05 13:20:46 UTC
Version:           v0.3 (using KDE 3.2.90 (3.3 alpha1, CVS >= 20040522), compiled sources)
Compiler:          gcc version 3.3.3 (Debian 20040422)
OS:                Linux (i686) release 2.6.6-1-k7

when zooming to 12.5. 33.33 and 66.67 per cent kpdf crashes and the following backtrace is produced:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 1096487168 (LWP 11743)]
[KCrash handler]
#3  0x412bd492 in XSetForeground () from /usr/X11R6/lib/libX11.so.6
#4  0x40b94698 in qsincos () from /usr/lib/libqt-mt.so.3
#5  0x40b95218 in QPainter::updateBrush () from /usr/lib/libqt-mt.so.3
#6  0x40c38edb in QPainter::setBrush () from /usr/lib/libqt-mt.so.3
#7  0x4197a272 in QOutputDev::updateFillColor ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#8  0x419a3f55 in Gfx::opSetFillGray ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#9  0x419a361f in Gfx::execOp ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#10 0x419a31c6 in Gfx::go ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#11 0x419a3041 in Gfx::display ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#12 0x419dab5a in Page::displaySlice ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#13 0x419da814 in Page::display ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#14 0x082af320 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x00000000 in ?? ()
#18 0xffffffff in ?? ()
#19 0xffffffff in ?? ()
#20 0xffffffff in ?? ()
#21 0xffffffff in ?? ()
#22 0x08094bf0 in ?? ()
#23 0x082a0910 in ?? ()
#24 0x00000000 in ?? ()
#25 0x00000000 in ?? ()
#26 0x41a22480 in __JCR_LIST__ ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
#27 0xbfffefe8 in ?? ()
#28 0x419d0cb4 in PDFDoc::displayPage ()
   from /home/test/kde3.3-alpha1/lib/kde3/libkpdfpart.so
Comment 1 Antti Markus 2004-08-29 17:44:40 UTC
I have this too but it seems that it's not the specific percentages - whenever I enter the zoom value as nn.n (ie 50.5) then KPDF crashes. If I enter the value as nn,n (ie 50,5) then KPDF doesn't crash. Also it seems that regional settings don't affect this issue (ie KPDF always crashes when zoom value is fractional and decimal delimiter is '.', even if decimal delimiter is '.' in regional settings)
Comment 2 Antti Markus 2004-08-29 17:48:33 UTC
KPDF version is v0.3 (KDE 3.3.0-1 Red Hat), I'm using Fedora Core 3 test1 (updated to the latest development packages).
Comment 3 Antti Markus 2004-08-29 18:12:07 UTC
Generally it seems that whenever a non-numeric zoom value is entered KPDF crashes.
Comment 4 Antti Markus 2004-08-29 21:48:49 UTC
Kpdf compiled from CVS has the same issue.
Comment 5 Antti Markus 2004-08-31 20:47:11 UTC
Created attachment 7372 [details]
patch to Kpdf part

- uses KLocale formatNumber to populate the zoom combo box
- if entered zoom value is not a number then don't resize the view
Comment 6 Antti Markus 2004-08-31 23:44:31 UTC
Created attachment 7377 [details]
Fixes crash, uses locale decimal symbol for zoom values

- use locale decimal symbol when populating zoom combo box
- retain fractional zoom values
- if entered zoom value is not a number do nothing instead of crashing
Comment 7 Albert Astals Cid 2004-09-02 20:15:17 UTC
CVS commit by aacid: 

Thanks Antti for the patch
CCMAIL:82877-done@bugs.kde.org


  M +14 -4     kpdf_part.cpp   1.51.2.3


--- kdegraphics/kpdf/kpdf/kpdf_part.cpp  #1.51.2.2:1.51.2.3
@@ -123,9 +123,14 @@ Part::Part(QWidget *parentWidget, const 
 
   QStringList translated;
+  QString localValue;
+  QString double_oh("00");
   int idx = 0;
   int cur = 0;
   for ( int i = 0; i < 10;i++)
   {
-      translated << QString( "%1%" ).arg( zoomValue[i] * 100.0 );
+      localValue = KGlobal::locale()->formatNumber( zoomValue[i] * 100.0, 2 );
+      localValue.remove( KGlobal::locale()->decimalSymbol()+double_oh );
+
+      translated << QString( "%1%" ).arg( localValue );
       if ( zoomValue[i] == 1.0 )
           idx = cur;
@@ -162,7 +167,12 @@ void Part::slotZoom( const QString&nz )
     double zoom;
     z.remove(  z.find(  '%' ), 1 );
-    zoom = KGlobal::locale()->readNumber(  z ) / 100;
+    bool isNumber = true;
+    zoom = KGlobal::locale()->readNumber(  z, &isNumber ) / 100;
+ 
+    if ( isNumber )
+    {
     kdDebug() << "ZOOM = "  << nz << ", setting zoom = " << zoom << endl;
     m_outputDev->zoomTo( zoom );
+    }
 }