mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Revert "Do not abort application shutdown when we need to save documents"
This reverts commit 73f82c6c5c.
Conflicts:
Frameworks/DocumentWindow/src/DocumentController.mm
This commit is contained in:
@@ -39,6 +39,7 @@ static NSString* const kUserDefaultsFindInSelectionByDefault = @"findInSelection
|
||||
static NSString* const kUserDefaultsDisableFolderStateRestore = @"disableFolderStateRestore";
|
||||
static NSString* const kUserDefaultsHideStatusBarKey = @"hideStatusBar";
|
||||
static NSString* const OakDocumentPboardType = @"OakDocumentPboardType"; // drag’n’drop of tabs
|
||||
static BOOL IsInShouldTerminateEventLoop = NO;
|
||||
|
||||
@interface QuickLookNSURLWrapper : NSObject <QLPreviewItem>
|
||||
@property (nonatomic) NSURL* url;
|
||||
@@ -461,6 +462,9 @@ namespace
|
||||
{
|
||||
case NSAlertFirstButtonReturn: /* "Save" */
|
||||
{
|
||||
if(std::exchange(IsInShouldTerminateEventLoop, NO))
|
||||
[NSApp replyToApplicationShouldTerminate:NO];
|
||||
|
||||
[DocumentSaveHelper trySaveDocuments:documentsToSave forWindow:self.window defaultDirectory:self.untitledSavePath completionHandler:^(BOOL success){
|
||||
callback(success);
|
||||
}];
|
||||
@@ -692,11 +696,17 @@ namespace
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
IsInShouldTerminateEventLoop = YES;
|
||||
|
||||
DocumentController* controller = [SortedControllers() firstObject];
|
||||
[controller showCloseWarningUIForDocuments:documents completionHandler:^(BOOL canClose){
|
||||
if(canClose)
|
||||
[self saveSessionAndDetachBackups];
|
||||
[NSApp replyToApplicationShouldTerminate:canClose];
|
||||
|
||||
if(std::exchange(IsInShouldTerminateEventLoop, NO))
|
||||
[NSApp replyToApplicationShouldTerminate:canClose];
|
||||
else if(canClose)
|
||||
[NSApp terminate:self];
|
||||
}];
|
||||
|
||||
return NSTerminateLater;
|
||||
|
||||
Reference in New Issue
Block a user