Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Vim crashing when querying serverlist when quitting #1427

Merged
merged 1 commit into from
Sep 9, 2023
Merged
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
17 changes: 13 additions & 4 deletions src/MacVim/MMBackend.m
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ - (void)dealloc
[outputQueue release]; outputQueue = nil;
[drawData release]; drawData = nil;
[connection release]; connection = nil;
[appProxy release]; appProxy = nil;
[actionDict release]; actionDict = nil;
[sysColorDict release]; sysColorDict = nil;
[colorDict release]; colorDict = nil;
Expand Down Expand Up @@ -1746,11 +1747,11 @@ - (NSArray *)serverList
{
NSArray *list = nil;

if ([self connection]) {
id proxy = [connection rootProxy];
[proxy setProtocolForProxy:@protocol(MMAppProtocol)];

if ([self connection] && [connection isValid]) {
@try {
id proxy = [connection rootProxy];
[proxy setProtocolForProxy:@protocol(MMAppProtocol)];

list = [proxy serverList];
}
@catch (NSException *ex) {
Expand Down Expand Up @@ -2535,6 +2536,14 @@ - (void)connectionDidDie:(NSNotification * UNUSED)notification

ASLogNotice(@"Main connection was lost before process had a chance "
"to terminate; preserving swap files.");

// Just release the connection, in case some autocmd's end up triggering
// IPC calls during shutdown. If other code use isValid checks this is a
// little unnecessary, but it just helps prevent issues with code that use
// the connection or proxy without checking for validity first.
[connection release]; connection = nil;
[appProxy release]; appProxy = nil;

getout_preserve_modified(1);
}

Expand Down