Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/MacVim/MMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,15 @@ - (void)applicationWillTerminate:(NSNotification *)notification
andEventID:'MOD '];
#endif

// We are hard shutting down the app here by terminating all Vim processes
// and then just quit without cleanly removing each Vim controller. We
// don't want the straggler controllers to still interact with the now
// invalid connections, so we just mark them as uninitialized.
for (NSUInteger i = 0, count = [vimControllers count]; i < count; ++i) {
MMVimController *vc = [vimControllers objectAtIndex:i];
[vc uninitialize];
}

// This will invalidate all connections (since they were spawned from this
// connection).
[connection invalidate];
Expand Down
1 change: 1 addition & 0 deletions src/MacVim/MMVimController.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}

- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
- (void)uninitialize;
- (unsigned)vimControllerId;
- (id)backendProxy;
- (int)pid;
Expand Down
9 changes: 9 additions & 0 deletions src/MacVim/MMVimController.m
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ - (void)dealloc
[super dealloc];
}

/// This should only be called by MMAppController when it's doing an app quit.
/// We just wait for all Vim processes to terminate instad of individually
/// closing each MMVimController. We simply unset isInitialized to prevent it
/// from handling and sending messages to now invalid Vim connections.
- (void)uninitialize
{
isInitialized = NO;
}

- (unsigned)vimControllerId
{
return identifier;
Expand Down