diff --git a/ChangeLog b/ChangeLog index fab38e4b2..5bd8d6dc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 2010-01-11 Wolfgang Lux - * Source/NSProgressIndicator.m (-setDisplayedWhenStopped): Fix + * Source/NSDocument.m (-writeSafelyToURL:ofType:...): Ensure + proper working of autosaving for subclasses that override + -writeWithBackupToFile:ofType:saveOperation. + + * Source/NSProgressIndicator.m (-setDisplayedWhenStopped:): Fix incorrect assignment which made this method a no-op. 2010-01-11 Fred Kiefer diff --git a/Source/NSDocument.m b/Source/NSDocument.m index a72eebc4f..a9af43c0a 100644 --- a/Source/NSDocument.m +++ b/Source/NSDocument.m @@ -868,15 +868,28 @@ withContentsOfURL: (NSURL *)url if (OVERRIDDEN(writeWithBackupToFile:ofType:saveOperation:)) { + BOOL isAutosave = NO; + if (op == NSAutosaveOperation) { op = NSSaveToOperation; + isAutosave = YES; } *error = nil; - return [self writeWithBackupToFile: [url path] - ofType: type - saveOperation: op]; + if (![self writeWithBackupToFile: [url path] + ofType: type + saveOperation: op]) + { + return NO; + } + + if (isAutosave) + { + [self setAutosavedContentsFileURL: url]; + [self updateChangeCount: NSChangeAutosaved]; + } + return YES; } if (!isNativeType || (url == nil))