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

List:       kde-commits
Subject:    branches/KDE/4.2/kdeedu/marble/src/lib
From:       Torsten Rahn <tackat () kde ! org>
Date:       2009-02-22 19:22:18
Message-ID: 1235330538.392349.15430.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 930168 by rahn:


- Fix bug reported by jmho which makes Marble crash if the user sets
  the physical cache to zero size.





 M  +6 -6      TileLoader.cpp  


--- branches/KDE/4.2/kdeedu/marble/src/lib/TileLoader.cpp #930167:930168
@@ -152,11 +152,11 @@
     while ( it.hasNext() ) {
         it.next();
         if ( it.value()->used() == false ) {
-
+            // If inCache == false then the cache is too small to store the tile 
+            // but the item will get deleted nevertheless and the pointer we have 
+            // doesn't get set to zero (so don't delete it in this case or it will crash!)
             bool inCache = d->m_tileCache.insert( it.key(), it.value(), it.value()->numBytes() );
             d->m_tileHash.remove( it.key() );
-            if ( inCache == false )
-                delete it.value();
         }
     }
 }
@@ -167,11 +167,11 @@
     QHashIterator<TileId, TextureTile*> it( d->m_tileHash );
     while ( it.hasNext() ) {
         it.next();
-
+        // If inCache == false then the cache is too small to store the tile 
+        // but the item will get deleted nevertheless and the pointer we have 
+        // doesn't get set to zero (so don't delete it in this case or it will crash!)
         bool inCache = d->m_tileCache.insert( it.key(), it.value(), it.value()->numBytes() );
         d->m_tileHash.remove( it.key() );
-        if ( inCache == false )
-            delete it.value();
     }
 
     d->m_tileHash.clear();
[prev in list] [next in list] [prev in thread] [next in thread] 

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