Bug 132679

Summary: filelight crashes freeing invalid pointer
Product: [Applications] filelight Reporter: Tomas Pospisek <tpo_deb>
Component: generalAssignee: Max Howell <max.howell>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tomas Pospisek 2006-08-20 10:31:37 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 4.1.2 
OS:                Linux

What I was doing to make the crash happen:

* i started filelight
* i selected some mounted drive
* i resized the window a few times
* i put it in the background by moving a different window in front of it and then:

filelight: >> void RadialMap::Map::setRingBreadth()
filelight: >> void RadialMap::Map::paint(unsigned int)
filelight: >> bool RadialMap::Map::resize(const QRect&)
filelight: >> void RadialMap::Map::setRingBreadth()
filelight: >> void RadialMap::Map::paint(unsigned int)
filelight: >> bool RadialMap::Map::resize(const QRect&)
filelight: >> void RadialMap::Map::setRingBreadth()
filelight: >> void RadialMap::Map::paint(unsigned int)
filelight: >> bool RadialMap::Map::resize(const QRect&)
filelight: >> void RadialMap::Map::setRingBreadth()
filelight: >> void RadialMap::Map::paint(unsigned int)
filelight: >> bool RadialMap::Map::resize(const QRect&)
filelight: >> bool RadialMap::Map::resize(const QRect&)
filelight: >> void RadialMap::Map::make(const Directory*, bool)
filelight: >> void RadialMap::Map::setRingBreadth()
filelight: >> void RadialMap::Map::colorise()
filelight: >> void RadialMap::Map::paint(unsigned int)
*** glibc detected *** free(): invalid pointer: 0xb6810ac0 ***
KCrash: Application 'filelight' crashing...


[1]+  Exit 253                src/app/filelight

This is with filelight 1.0-rc1.
*t
Comment 1 Max Howell 2006-08-21 02:54:51 UTC
This will be hard to fix without a backtrace, but I'll try to reproduce in the near future. If you can reproduce on a regular basis, a backtrace from a debug compiled Filelight would be excellent thanks :)
Comment 2 Max Howell 2006-08-21 23:59:16 UTC
SVN commit 575695 by mhowell:

BUG: 132679

Maybe fixes this crash on startup. I can't reproduce so I can't be sure.
RC2 will be released tomorrow or today if I have time.



 M  +15 -9     map.cpp  


--- trunk/extragear/utils/filelight/src/part/radialMap/map.cpp #575694:575695
@@ -22,15 +22,15 @@
 
 
 RadialMap::Map::Map()
-: m_signature( 0 )
-, m_ringBreadth( MIN_RING_BREADTH )
-, m_innerRadius( 0 )
-, m_visibleDepth( DEFAULT_RING_DEPTH )
+        : m_signature( 0 )
+        , m_ringBreadth( MIN_RING_BREADTH )
+        , m_innerRadius( 0 )
+        , m_visibleDepth( DEFAULT_RING_DEPTH )
 {
-   //FIXME this is all broken. No longer is a maximum depth!
-   const int fmh   = QFontMetrics( QFont() ).height();
-   const int fmhD4 = fmh / 4;
-   MAP_2MARGIN = 2 * ( fmh - (fmhD4 - LABEL_MAP_SPACER) ); //margin is dependent on fitting in labels at top and bottom
+    //FIXME this is all broken. No longer is a maximum depth!
+    const int fmh   = QFontMetrics( QFont() ).height();
+    const int fmhD4 = fmh / 4;
+    MAP_2MARGIN = 2 * ( fmh - (fmhD4 - LABEL_MAP_SPACER) ); //margin is dependent on fitting in labels at top and bottom
 }
 
 RadialMap::Map::~Map()
@@ -146,6 +146,10 @@
       size += MAP_2MARGIN;
       KPixmap::resize( size, size );
 
+      // for summary widget this is a good optimisation as it happens
+      if (KPixmap::isNull())
+          return false;
+
       if( m_signature != 0 )
       {
          setRingBreadth();
@@ -292,7 +296,7 @@
 {
    DEBUG_ANNOUNCE
 
-   if( scaleFactor == 0 ) //just in case
+   if (scaleFactor == 0) //just in case
       scaleFactor = 1;
 
    QPainter paint;
@@ -322,6 +326,8 @@
    //**** best option you can think of is to make the circles slightly less perfect,
    //  ** i.e. slightly eliptic when resizing inbetween
 
+   if (KPixmap::isNull())
+      return;
 
    paint.begin( this );
 
Comment 3 Tomas Pospisek 2006-08-30 00:15:48 UTC
Confirming: this one is fixed too. Thanks.