From bd1ad31ee7195b89808fa056eb6702e0993c18ea Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Wed, 8 Apr 2009 19:36:00 +0200 Subject: [PATCH] Deprecate performSelectorOnMainThread calls Use performSelector:withObject:after:delay instead since it automatically only triggers in default mode. --- src/MacVim/MMAppController.m | 6 +++--- src/MacVim/MMBackend.m | 6 +++--- src/MacVim/MMVimController.m | 40 +++++++++++++++------------------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index dffe0772..130a4162 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -1123,8 +1123,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // arrive at unpredictable times (e.g. while iterating the list of vim // controllers). // (What if input arrives before the vim controller is added to the list of - // controllers? This is not a problem since the input isn't processed - // immediately (see processInput:forIdentifier:).) + // controllers? This should not be a problem since the input isn't + // processed immediately (see processInput:forIdentifier:).) MMVimController *vc = [[MMVimController alloc] initWithBackend:proxy pid:pid]; [self performSelector:@selector(addVimController:) @@ -2133,7 +2133,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // not need to worry about it. // The processing flag is > 0 if this function is already on the call - // stack; < 0 if this function was re-entered. + // stack; < 0 if this function was also re-entered. if (processingFlag != 0) { NSLog(@"[%s] BUSY!", _cmd); processingFlag = -1; diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 155e3d35..50904ff9 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -2480,9 +2480,9 @@ extern GuiFont gui_mch_retain_font(GuiFont font); if ([args objectForKey:@"remoteID"]) { // NOTE: We have to delay processing any ODB related arguments since // the file(s) may not be opened until the input buffer is processed. - [self performSelectorOnMainThread:@selector(startOdbEditWithArguments:) - withObject:args - waitUntilDone:NO]; + [self performSelector:@selector(startOdbEditWithArguments:) + withObject:args + afterDelay:0]; } NSString *lineString = [args objectForKey:@"cursorLine"]; diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 6c1c5b9a..e086b32a 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -521,11 +521,9 @@ static unsigned identifierCounter = 1; if (delayQueue) { //NSLog(@" Flushing delay queue (%d items)", [delayQueue count]/2); - [self performSelectorOnMainThread:@selector(processInputQueue:) - withObject:delayQueue - waitUntilDone:NO - modes:[NSArray arrayWithObject: - NSDefaultRunLoopMode]]; + [self performSelector:@selector(processInputQueue:) + withObject:delayQueue + afterDelay:0]; } } @@ -722,11 +720,9 @@ static unsigned identifierCounter = 1; // The popup menu enters a modal loop so delay this call so that we // don't block inside processInputQueue:. - [self performSelectorOnMainThread:@selector(popupMenuWithAttributes:) - withObject:attrs - waitUntilDone:NO - modes:[NSArray arrayWithObject: - NSDefaultRunLoopMode]]; + [self performSelector:@selector(popupMenuWithAttributes:) + withObject:attrs + afterDelay:0]; } else if (SetMouseShapeMsgID == msgid) { const void *bytes = [data bytes]; int shape = *((int*)bytes); bytes += sizeof(int); @@ -1246,11 +1242,9 @@ static unsigned identifierCounter = 1; // following call ensures that the vim controller is not released until the // run loop is back in the 'default' mode. [[MMAppController sharedInstance] - performSelectorOnMainThread:@selector(removeVimController:) - withObject:self - waitUntilDone:NO - modes:[NSArray arrayWithObject: - NSDefaultRunLoopMode]]; + performSelector:@selector(removeVimController:) + withObject:self + afterDelay:0]; } - (void)handleBrowseForFile:(NSDictionary *)attr @@ -1261,11 +1255,9 @@ static unsigned identifierCounter = 1; isEqual:NSDefaultRunLoopMode]; if (!inDefaultMode) { // Delay call until run loop is in default mode. - [self performSelectorOnMainThread:@selector(handleBrowseForFile:) - withObject:attr - waitUntilDone:NO - modes:[NSArray arrayWithObject: - NSDefaultRunLoopMode]]; + [self performSelector:@selector(handleBrowseForFile:) + withObject:attr + afterDelay:0]; return; } @@ -1308,11 +1300,9 @@ static unsigned identifierCounter = 1; isEqual:NSDefaultRunLoopMode]; if (!inDefaultMode) { // Delay call until run loop is in default mode. - [self performSelectorOnMainThread:@selector(handleShowDialog:) - withObject:attr - waitUntilDone:NO - modes:[NSArray arrayWithObject: - NSDefaultRunLoopMode]]; + [self performSelector:@selector(handleShowDialog:) + withObject:attr + afterDelay:0]; return; } -- 2.11.4.GIT