Commit 04a7782
committed
Skip Preferences close work during app terminate
PreferencesController.handleWillClose: runs read_config_file,
machine reselection, scaler hotswap, [machineRomsController
setContent:nil], and [machineRoms release] alongside removing its
NSWindowWillCloseNotification observer. When [NSApp terminate:]
cascade-closes the windows with Preferences still open, the
WillClose notification fires the handler and one of those teardowns
reaches into NSWindow's notification observer table while it is
still being walked. _platform_strcmp segfaults inside
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__.
Latent in the runModal era: the modal session blocked Cmd+Q
delivery, so the user could not quit with Preferences open.
Removing runModal reaches this path.
Register a class-target observer for
NSApplicationWillTerminateNotification (which fires before the
close cascade), set a file-static flag, and short-circuit
handleWillClose: when it is set. Settings have already been
persisted to NSUserDefaults via the binding chain by the time the
user clicks Quit, so the work being skipped is the apply-back
path: meaningless at exit and dangerous when invoked from inside
the terminate cascade.1 parent 5eaed9a commit 04a7782
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
63 | 89 | | |
64 | 90 | | |
65 | 91 | | |
| |||
225 | 251 | | |
226 | 252 | | |
227 | 253 | | |
| 254 | + | |
| 255 | + | |
228 | 256 | | |
229 | 257 | | |
230 | 258 | | |
| |||
0 commit comments