AutoSave for Windows
AutoSave for Windows
- Subject: AutoSave for Windows
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 22 Nov 2016 13:34:42 +0700
macOS 12.1, Xcode Version 8.1 (8T61a).
App with two windows: FestEvent and Preferences, which have Autosave names of FestEvent, resp. Preferences.
Start App → FestEvent window will show.
Make it to show Preferences window as well.
Move both windows around and observe Preferences.plist to have absolutely plausible values for both: “NSWindow Frame Preferences” and: “NSWindow Frame FestEvent”.
Quit the app.
Start App again → FestEvent window will show, but NOT at its previous location as recorded in Preferences.plist, but at the location of the Preferences window.
At this second run of my app the following happens:
13:15:49.967892 -[AppDelegate applicationDidFinishLaunching:] Preferences 1030 348 383 83 0 0 1440 877
13:15:49.967929 -[AppDelegate applicationDidFinishLaunching:] FestEvent 0 142 383 247 0 0 1440 877
13:16:06.615131 -[FestWindowController windowDidResize:] FestEvent {{0, 142}, {383, 247}}
13:16:06.639579 -[FestWindowController windowDidLoad] FestEvent {{0, 142}, {383, 247}}
13:16:06.714612 -[AppDelegate applicationDidFinishLaunching:] FestEvent {{0, 142}, {383, 247}}
So far everything is fine: the FestEvent window has the correct location.
But now some obnoxious NSPersistentUIRestorer takes over:
13:16:14.950504 -[FestWindowController windowDidResize:] FestEvent {{1030, 348}, {383, 83}}
Note: this is the location of the Preferences window.
(lldb) bt
* thread #1: tid = 0x20a79e, 0x0000000100007784 FestEvent`-[FestWindowController windowDidResize:](self=0x00006180000e0900, _cmd="windowDidResize:", notification=@"NSWindowDidResizeNotification") + 260 at FestWindowController.m:116, queue = 'com.apple.main-thread', stop reason = step over
* frame #0: 0x0000000100007784 FestEvent`-[FestWindowController windowDidResize:](self=0x00006180000e0900, _cmd="windowDidResize:", notification=@"NSWindowDidResizeNotification") + 260 at FestWindowController.m:116
frame #1: 0x00007fff8dba95ec CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
frame #2: 0x00007fff8dba94eb CoreFoundation`_CFXRegistrationPost + 427
frame #3: 0x00007fff8dba9252 CoreFoundation`___CFXNotificationPost_block_invoke + 50
frame #4: 0x00007fff8db67972 CoreFoundation`-[_CFXNotificationRegistrar find:object:observer:enumerator:] + 2018
frame #5: 0x00007fff8db6695b CoreFoundation`_CFXNotificationPost + 667
frame #6: 0x00007fff8f5940e3 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66
frame #7: 0x00007fff8b8e6177 AppKit`-[NSWindow _setFrameCommon:display:stashSize:] + 3326
frame #8: 0x00007fff8b8e546b AppKit`-[NSWindow _setFrame:display:allowImplicitAnimation:stashSize:] + 222
frame #9: 0x00007fff8b8e5386 AppKit`-[NSWindow setFrame:display:] + 67
frame #10: 0x00007fff8b8e4e9f AppKit`-[NSWindow _setFrameFromString:overrideTopLeft:preferActiveDisplay:constrainFullFrame:force:] + 1398
frame #11: 0x00007fff8bb548c5 AppKit`-[NSWindow restoreStateWithCoder:] + 902
frame #12: 0x00007fff8bb144ec AppKit`restorePersistentStateWithWindowRestoration + 1043
frame #13: 0x00007fff8bb54501 AppKit`-[NSPersistentUIRestorer invokeRestoration:] + 574
frame #14: 0x00007fff8bb54264 AppKit`__79-[NSPersistentUIRestorer finishedRestoringWindowsWithZOrder:completionHandler:]_block_invoke + 219
frame #15: 0x00007fff8bb5402b AppKit`+[NSWindow _batchMinimizeWindowsWithBlock:] + 89
frame #16: 0x00007fff8bb14a29 AppKit`-[NSPersistentUIRestorer finishedRestoringWindowsWithZOrder:completionHandler:] + 746
frame #17: 0x00007fff8bb532e8 AppKit`__82-[NSPersistentUIRestorer restoreStateFromRecords:usingDelegate:completionHandler:]_block_invoke_3 + 166
frame #18: 0x00007fff8bb5321b AppKit`__99-[NSApplication(NSPersistentUIRestorationSupport) _restoreWindowWithRestoration:completionHandler:]_block_invoke + 401
frame #19: 0x00007fff8c26350f AppKit`__99-[NSApplication(NSPersistentUIRestorationSupport) _restoreWindowWithRestoration:completionHandler:]_block_invoke.762 + 57
frame #20: 0x00007fff8dbb330c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #21: 0x00007fff8db94634 CoreFoundation`__CFRunLoopDoBlocks + 356
frame #22: 0x00007fff8db93da5 CoreFoundation`__CFRunLoopRun + 917
frame #23: 0x00007fff8db937b4 CoreFoundation`CFRunLoopRunSpecific + 420
frame #24: 0x00007fff8d12ffbc HIToolbox`RunCurrentEventLoopInMode + 240
frame #25: 0x00007fff8d12fcf9 HIToolbox`ReceiveNextEventCommon + 184
frame #26: 0x00007fff8d12fc26 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
frame #27: 0x00007fff8b819b79 AppKit`_DPSNextEvent + 1093
frame #28: 0x00007fff8bf2f1c3 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1637
frame #29: 0x00007fff8b80e53d AppKit`-[NSApplication run] + 926
frame #30: 0x00007fff8b7d91ad AppKit`NSApplicationMain + 1237
frame #31: 0x0000000100006f02 FestEvent`main(argc=3, argv=0x00007fff5fbff6d0) + 34 at main.m:12
frame #32: 0x00007fffa2d00255 libdyld.dylib`start + 1
How to prevent this?
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden