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

List:       kde-commits
Subject:    kdegames/kasteroids
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-02-17 21:35:04
Message-ID: 20040217213504.5BD4C995B () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Fix crash when both shield and ship hit powerup at same time. (BR69324)


  M +4 -2      view.cpp   1.41


--- kdegames/kasteroids/view.cpp  #1.40:1.41
@@ -783,7 +783,7 @@ void KAsteroidsView::processPowerups()
         QPtrListIterator<KPowerup> it( powerups );
 
-        for( ; it.current(); ++it )
+        for( ; (pup = it.current()); )
         {
-            pup = it.current();
+            ++it; // We have to increase here, because pup may get deleted.
             pup->growOlder();
 
@@ -828,4 +828,5 @@ void KAsteroidsView::processPowerups()
                     powerups.removeRef( pup );
                     vitalsChanged = true;
+                    break;
                 }
 
@@ -835,4 +836,5 @@ void KAsteroidsView::processPowerups()
                     {
                       powerups.removeRef( pup );
+                      break;
                     }
                 }


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

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