From d4232cf08b6b48e9acea2d8e3cd842c329c583f3 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Wed, 25 Nov 2015 21:53:26 +0000 Subject: [PATCH] #6022: Prevent stack overflow when stallness changes for lots of torrents at the same time --- macosx/Torrent.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index c19c58e7f..c6bd81596 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -325,8 +325,12 @@ bool trashDataFile(const char * filename, tr_error ** error) //make sure the "active" filter is updated when stalled-ness changes if (wasStalled != [self isStalled]) - [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self]; - + //posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time + [[NSNotificationQueue defaultQueue] enqueueNotification: [NSNotification notificationWithName: @"UpdateQueue" object: self] + postingStyle: NSPostASAP + coalesceMask: NSNotificationCoalescingOnName + forModes: nil]; + //when the torrent is first loaded, update the time machine exclusion if (!fTimeMachineExcludeInitialized) [self updateTimeMachineExclude];