mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
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:
@@ -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);
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user