I’m writing an app, and adapted the code in 17.10 (“Enabling the Preferences Window”). Just for fun, I hit Apple-comma WHILE the Preferences window was up, and a second Preferences window appeared.
I then downloaded the code and compiled and ran Persistence/HelloApplication40, and sure enough, it, too, creates multiple Preferences windows.
Commercial apps don’t have this problem; it seems to be because openPreferences always allocates a new PreferencesController. But I can’t figure out how to hang onto the existing one and yet lose the pointer when it releases itself in windowWillClose (page 275).
What am I missing? Thanks.