Add diagnostics to track down KVO issue

I see the following exception from macOS 10.12 users: Cannot update for observer <DocumentWindowController 0xhhh…> for the key path "selectedDocument.documentEdited" from <DocumentWindowController 0xhhh…>, most likely because the value for the key "selectedDocument" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the DocumentWindowController class.
This commit is contained in:
Allan Odgaard
2016-10-07 11:10:37 +02:00
parent 1d7c168cb8
commit 37b417f769

View File

@@ -34,6 +34,7 @@
#import <settings/settings.h>
#import <ns/ns.h>
#import <kvdb/kvdb.h>
#import <crash/info.h>
static NSString* const kUserDefaultsAlwaysFindInDocument = @"alwaysFindInDocument";
static NSString* const kUserDefaultsDisableFolderStateRestore = @"disableFolderStateRestore";
@@ -1030,6 +1031,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p
}
[self makeTextViewFirstResponder:self];
crash_reporter_info_t crashInfo(text::format("old selected document %s, new selected document %s", [_selectedDocument.displayName UTF8String] ?: "nil", [document.displayName UTF8String] ?: "nil"));
self.selectedDocument = document;
[self performSelector:@selector(didOpenDocuemntInTextView:) withObject:self.documentView.textView afterDelay:0];
[document close];