Skip to content
Snippets Groups Projects
Commit ef3ef929 authored by George Nachman's avatar George Nachman
Browse files

When iTerm2 is terminating, detach from tmux gateways before windows are closed. Issue 4926

parent 529627d6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -456,6 +456,14 @@ static const NSTimeInterval kBackgroundUpdateCadence = 1;
selector:@selector(profileSessionNameDidEndEditing:)
name:kProfileSessionNameDidEndEditing
object:nil];
// Detach before windows get closed. That's why we have to use the
// iTermApplicationWillTerminate notification instead of
// NSApplicationWillTerminate, since this gets run before the windows
// are released.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillTerminate:)
name:iTermApplicationWillTerminate
object:nil];
[self updateVariables];
}
return self;
Loading
Loading
@@ -3641,6 +3649,11 @@ ITERM_WEAKLY_REFERENCEABLE
[self sanityCheck];
}
 
- (void)applicationWillTerminate:(NSNotification *)notification {
// See comment where we observe this notification for why this is done.
[self tmuxDetach];
}
- (void)synchronizeTmuxFonts:(NSNotification *)notification
{
if (!_exited && [self isTmuxClient]) {
Loading
Loading
@@ -4123,18 +4136,15 @@ ITERM_WEAKLY_REFERENCEABLE
}
}
 
- (BOOL)isTmuxClient
{
- (BOOL)isTmuxClient {
return self.tmuxMode == TMUX_CLIENT;
}
 
- (BOOL)isTmuxGateway
{
- (BOOL)isTmuxGateway {
return self.tmuxMode == TMUX_GATEWAY;
}
 
- (void)tmuxDetach
{
- (void)tmuxDetach {
if (self.tmuxMode != TMUX_GATEWAY) {
return;
}
Loading
Loading
Loading
Loading
@@ -40,6 +40,7 @@ extern NSString *const kNonTerminalWindowBecameKeyNotification;
extern NSString *const kMarkAlertActionModalAlert;
extern NSString *const kMarkAlertActionPostNotification;
extern NSString *const kShowFullscreenTabsSettingDidChange;
extern NSString *const iTermApplicationWillTerminate;
 
int DebugLogImpl(const char *file, int line, const char *function, NSString* value);
 
Loading
Loading
Loading
Loading
@@ -91,6 +91,7 @@ static NSString *const kHotkeyWindowRestorableState = @"kHotkeyWindowRestorableS
static NSString *const kHaveWarnedAboutIncompatibleSoftware = @"NoSyncHaveWarnedAboutIncompatibleSoftware";
 
static NSString *const kRestoreDefaultWindowArrangementShortcut = @"R";
NSString *const iTermApplicationWillTerminate = @"iTermApplicationWillTerminate";
 
static BOOL gStartupActivitiesPerformed = NO;
// Prior to 8/7/11, there was only one window arrangement, always called Default.
Loading
Loading
@@ -593,6 +594,9 @@ static BOOL hasBecomeActive = NO;
[[iTermController sharedInstance] killRestorableSessions];
}
 
// Last chance before windows get closed.
[[NSNotificationCenter defaultCenter] postNotificationName:iTermApplicationWillTerminate object:nil];
// This causes all windows to be closed and all sessions to be terminated.
[iTermController releaseSharedInstance];
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment