From 50be9d42271e8f2bd2aa33143e4319d73b090251 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Thu, 14 Aug 2008 18:32:28 +0200 Subject: [PATCH] Avoid "dropping incoming DO message ..." being logged These warnings were caused by a Vim process sending a DO message and then immediately exiting so that the process would some times die before the message was received by MacVim. --- src/MacVim/MMBackend.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index c162655f7b..3dbccd6f1a 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -58,6 +58,12 @@ static int eventModifierFlagsToVimModMask(int modifierFlags); static int eventModifierFlagsToVimMouseModMask(int modifierFlags); static int eventButtonNumberToVimMouseButton(int buttonNumber); +// Before exiting process, sleep for this many microseconds. This is to allow +// any distributed object messages in transit to be received by MacVim before +// the process dies (otherwise an error message is logged by Cocoa). Note that +// this delay is only necessary if an NSConnection to MacVim has been +// established. +static useconds_t MMExitProcessDelay = 300000; // In gui_macvim.m vimmenu_T *menu_for_descriptor(NSArray *desc); @@ -590,7 +596,6 @@ static NSString *MMSymlinkWarningString = NSData *data = [NSData dataWithBytes:&msgid length:sizeof(int)]; NSArray *q = [NSArray arrayWithObjects:data, [NSData data], nil]; [frontendProxy processCommandQueue:q]; - //usleep(10000); } @catch (NSException *e) { NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e); @@ -610,6 +615,7 @@ static NSString *MMSymlinkWarningString = fontContainerRef = 0; } + usleep(MMExitProcessDelay); } - (void)selectTab:(int)index @@ -1544,6 +1550,7 @@ static NSString *MMSymlinkWarningString = // NOTE: We intentionally do not call mch_exit() since this in turn // will lead to -[MMBackend exit] getting called which we want to // avoid. + usleep(MMExitProcessDelay); exit(0); }