Skip to content

Commit

Permalink
Fix closing bug from deadlocking
Browse files Browse the repository at this point in the history
Could be related to #678, #433, #263. Confirmation needed.
  • Loading branch information
uranusjr committed Oct 21, 2016
1 parent 595906b commit be1b608
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -448,28 +448,11 @@ - (void)reloadFromLoadedString
}
}

- (void)canCloseDocumentWithDelegate:(id)delegate
shouldCloseSelector:(SEL)selector contextInfo:(void *)context
{
selector = @selector(document:shouldClose:contextInfo:);
[super canCloseDocumentWithDelegate:delegate shouldCloseSelector:selector
contextInfo:context];
}

- (void)document:(NSDocument *)doc shouldClose:(BOOL)shouldClose
contextInfo:(void *)contextInfo
{
if (!shouldClose)
return;

[self close];
}

- (void)close
{
if (self.needsToUnregister)
{
// close can be called multiple times
// Close can be called multiple times, but this can only be done once.
// http://www.cocoabuilder.com/archive/cocoa/240166-nsdocument-close-method-calls-itself.html
self.needsToUnregister = NO;

Expand Down

0 comments on commit be1b608

Please sign in to comment.