From ce98998fd75b9da258172b29ec635b2b5170b466 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Fri, 7 Oct 2016 11:10:37 +0200 Subject: [PATCH] Add diagnostics to track down KVO issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I see the following exception from macOS 10.12 users: Cannot update for observer for the key path "selectedDocument.documentEdited" from , 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. --- Frameworks/DocumentWindow/src/DocumentWindowController.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Frameworks/DocumentWindow/src/DocumentWindowController.mm b/Frameworks/DocumentWindow/src/DocumentWindowController.mm index be63cb59..ff188b79 100644 --- a/Frameworks/DocumentWindow/src/DocumentWindowController.mm +++ b/Frameworks/DocumentWindow/src/DocumentWindowController.mm @@ -34,6 +34,7 @@ #import #import #import +#import 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];