diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertOperation.m b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertOperation.m index baacb3c..f276c82 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertOperation.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertOperation.m @@ -157,11 +157,7 @@ if (self.topAlertObject.persistent) { return; } - self.timerSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); - if (!self.timerSource) { - // Log error - return; - } + NSInteger dismissTime; if (self.topAlertObject.topAlertDismissTime > 0) { dismissTime = self.topAlertObject.topAlertDismissTime; @@ -169,8 +165,10 @@ dismissTime = TopAlertDismissTime; } - __weak typeof(self) weakSelf = self; + self.timerSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); dispatch_source_set_timer(self.timerSource, dispatch_time(DISPATCH_TIME_NOW, dismissTime * NSEC_PER_SEC), DISPATCH_TIME_FOREVER, (1ull * NSEC_PER_SEC) / 10); + + __weak typeof(self) weakSelf = self; dispatch_source_set_event_handler(self.timerSource, ^{ if (weakSelf.isFinished || [weakSelf checkAndHandleForCancellation]) { return;