File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -759,6 +759,15 @@ - (void)applicationWillTerminate:(NSNotification *)notification
759759 andEventID: ' MOD ' ];
760760#endif
761761
762+ // We are hard shutting down the app here by terminating all Vim processes
763+ // and then just quit without cleanly removing each Vim controller. We
764+ // don't want the straggler controllers to still interact with the now
765+ // invalid connections, so we just mark them as uninitialized.
766+ for (NSUInteger i = 0 , count = [vimControllers count ]; i < count; ++i) {
767+ MMVimController *vc = [vimControllers objectAtIndex: i];
768+ [vc uninitialize ];
769+ }
770+
762771 // This will invalidate all connections (since they were spawned from this
763772 // connection).
764773 [connection invalidate ];
Original file line number Diff line number Diff line change 5757}
5858
5959- (id )initWithBackend : (id )backend pid : (int )processIdentifier ;
60+ - (void )uninitialize ;
6061- (unsigned )vimControllerId ;
6162- (id )backendProxy ;
6263- (int )pid ;
Original file line number Diff line number Diff line change @@ -248,6 +248,15 @@ - (void)dealloc
248248 [super dealloc ];
249249}
250250
251+ // / This should only be called by MMAppController when it's doing an app quit.
252+ // / We just wait for all Vim processes to terminate instad of individually
253+ // / closing each MMVimController. We simply unset isInitialized to prevent it
254+ // / from handling and sending messages to now invalid Vim connections.
255+ - (void )uninitialize
256+ {
257+ isInitialized = NO ;
258+ }
259+
251260- (unsigned )vimControllerId
252261{
253262 return identifier;
You can’t perform that action at this time.
0 commit comments