From 0994e96f3136eb8d384af52e1aa0fcc4a2c921c9 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Tue, 4 Jul 2017 22:59:55 +0300 Subject: [PATCH] Uncaught exception when dragging multiple items between groups (macOS) Change group after all the torrents are retrieved from drop data to avoid premature view item index changes. Fixes: #51 --- macosx/Controller.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 25d8aea3a..0a35cdb4d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -3163,10 +3163,15 @@ static void removeKeRangerRansomware() { Torrent * torrent = [fTableView itemAtRow: i]; [movingTorrents addObject: torrent]; + } - //change groups - if (item) - [torrent setGroupValue: [item groupIndex] determinationType: TorrentDeterminationUserSpecified]; + //change groups + if (item) + { + const NSInteger groupIndex = [item groupIndex]; + + for (Torrent * torrent in movingTorrents) + [torrent setGroupValue: groupIndex determinationType: TorrentDeterminationUserSpecified]; } //reorder queue order