Don’t delay “did save” notification to next event loop cycle

See 26e66b887a for details.
This commit is contained in:
Allan Odgaard
2016-07-10 10:45:59 +02:00
parent 26e66b887a
commit df3ef3cd81

View File

@@ -757,11 +757,6 @@ private:
// = Save Document =
// =================
- (void)postDidSaveNotification:(id)sender
{
[[NSNotificationCenter defaultCenter] postNotificationName:OakDocumentDidSaveNotification object:self];
}
- (void)didSaveAtPath:(NSString*)aPath withEncoding:(encoding::type)encoding success:(BOOL)success
{
if(success)
@@ -777,12 +772,7 @@ private:
if(!_recentTrackingDisabled && _path && !_virtualPath)
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:_path]];
// This method is indirectly being called from a block executed in the main
// queue, as saving is running in a background queue. We need to get out of that
// block before posting the “did save” notification as while we are in this
// block, new blocks wont be executed in the main queue, which we might rely
// on when running a local event loop (for executing commands).
[self performSelector:@selector(postDidSaveNotification:) withObject:self afterDelay:0];
[[NSNotificationCenter defaultCenter] postNotificationName:OakDocumentDidSaveNotification object:self];
}
self.observeFileSystem = self.isOpen;
}