]> granicus.if.org Git - transmission/commitdiff
possible fix for #2586
authorMitchell Livingston <livings124@transmissionbt.com>
Mon, 14 Dec 2009 23:35:55 +0000 (23:35 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Mon, 14 Dec 2009 23:35:55 +0000 (23:35 +0000)
macosx/Controller.m

index 6102e494936e995b714b574bec05e9bb28fc33d0..87426c17df5921d44f8a2e9edc9a50c94c685aa8 100644 (file)
@@ -1355,6 +1355,18 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
     
     [fTorrents removeObjectsInArray: torrents];
     
+    //if not removed from displayed torrents, updateTorrentsInQueue might cause a crash
+    if ([fDisplayedTorrents count] > 0)
+    {
+        if ([[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [TorrentGroup class]])
+        {
+            for (TorrentGroup * group in fDisplayedTorrents)
+                [[group torrents] removeObjectsInArray: torrents];
+        }
+        else
+            [fDisplayedTorrents removeObjectsInArray: torrents];
+    }
+    
     for (Torrent * torrent in torrents)
     {
         //let's expand all groups that have removed items - they either don't exist anymore, are already expanded, or are collapsed (rpc)