Deprecate performSelectorOnMainThread calls

Use performSelector:withObject:after:delay instead since it
automatically only triggers in default mode.
This commit is contained in:
Bjorn Winckler
2009-04-08 19:36:00 +02:00
parent e93e9c4201
commit dd76f85f0b
3 changed files with 21 additions and 31 deletions
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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"];
+15 -25
View File
@@ -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;
}