Skip to content

preferences-window: Don't crash on reuse

Once upon a time, in a faraway spatial file manager land, there was a way to open multiple preferences windows at once. Everytime a person launched the "File Management Properties" from the system menu, a new preferences window would always be spawned, even if there was already one such window open. [0]

Back then, the preferences window was not modal and could be launched even while there was no nautilus (excluding the special desktop one).

One day, a powerful wizard resolved this by summoning the existing preferences window instead of spawning more.[1] Peace had returned to the GNOME 2 land.

But the winds of change blew strong with GNOME 3. Desktop icons were exiled to the hidden configurations and spatial file manager became a myth of old, as the app-centric rule solidified. In that world, Preferences became modal dialogs.[2] The preferences summoning spell was still effective, but now had an unintended side effect: raising the parent window along with the existing preferences dialog, even summoned from another window. But this was nothing serious so nobody even noticed it.

The spell turned into a curse due to the GTK 4 lifecycle changes.[3] A closed Preferences window becomes a ghost window, lingering onto its original parent window. Be warned: those who dare summon the Preferences ghost once its parent window is gone, shall be crashed!

Henceforth, when opening Preferences, an existing window (either alive or undead) shall be exorcised, before a new window is spawned with from a new parent.

Fixes: #2986 (closed)

[0] https://bugzilla.gnome.org/show_bug.cgi?id=442263 [1] b97bad42 [2] c98de162 [3] https://docs.gtk.org/gtk4/migrating-3to4.html#life-cycle-handling

Merge request reports