Now works to use :maca on VimLeave auto command

To fix this the output queue is flushed before exiting a Vim process.
Also, the CloseWindowMsgID is added to the "unsafe" list so that other
unsafe messages (such as ExecuteActionMsgID) are not delayed until after
CloseWindowMsgID.
This commit is contained in:
Bjorn Winckler
2008-08-22 01:53:24 +02:00
parent dd46cfc500
commit 316034e1db
2 changed files with 22 additions and 13 deletions
+4 -4
View File
@@ -589,10 +589,10 @@ static NSString *MMSymlinkWarningString =
if ([connection isValid]) {
@try {
int msgid = CloseWindowMsgID;
NSData *data = [NSData dataWithBytes:&msgid length:sizeof(int)];
NSArray *q = [NSArray arrayWithObjects:data, [NSData data], nil];
[frontendProxy processCommandQueue:q];
// Flush the entire queue in case a VimLeave autocommand added
// something to the queue.
[self queueMessage:CloseWindowMsgID data:nil];
[frontendProxy processCommandQueue:outputQueue];
}
@catch (NSException *e) {
NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e);
+18 -9
View File
@@ -1457,17 +1457,26 @@ isUnsafeMessage(int msgid)
// example, UpdateTabBarMsgID may delete NSTabViewItem objects so it goes
// on this list.
static int unsafeMessages[] = { // REASON MESSAGE IS ON THIS LIST:
//OpenWindowMsgID, // Changes lots of state
UpdateTabBarMsgID, // May delete NSTabViewItem
RemoveMenuItemMsgID, // Deletes NSMenuItem
DestroyScrollbarMsgID, // Deletes NSScroller
ExecuteActionMsgID, // Impossible to predict
ShowPopupMenuMsgID, // Enters modal loop
ActivateMsgID, // ?
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
//OpenWindowMsgID, // Changes lots of state
UpdateTabBarMsgID, // May delete NSTabViewItem
RemoveMenuItemMsgID, // Deletes NSMenuItem
DestroyScrollbarMsgID, // Deletes NSScroller
ExecuteActionMsgID, // Impossible to predict
ShowPopupMenuMsgID, // Enters modal loop
ActivateMsgID, // ?
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
CloseWindowMsgID, // See note below
};
// NOTE about CloseWindowMsgID: If this arrives at the same time as say
// ExecuteActionMsgID, then the "execute" message will be lost due to it
// being queued and handled after the "close" message has caused the
// controller to cleanup...UNLESS we add CloseWindowMsgID to the list of
// unsafe messages. This is the _only_ reason it is on this list (since
// all that happens in response to it is that we schedule another message
// for later handling).
int i, count = sizeof(unsafeMessages)/sizeof(unsafeMessages[0]);
for (i = 0; i < count; ++i)
if (msgid == unsafeMessages[i])