Skip to content

2.0.2

Latest

Choose a tag to compare

@makoni makoni released this 13 Oct 05:43

Releasing a window's Swift wrapper no longer finalizes the window while GTK still lists it — and with it, the CRITICALs and the crash on the next toplevel walk. No source changes are needed to pick this up.

Fixed

A released window stays alive until it is destroyed. Window() and ApplicationWindow(application:) handed the transfer-ownership="none" pointer their constructors return to a wrapper that treated it as owned, stealing the reference GTK keeps in its toplevel list. Dropping the Swift wrapper then finalized a window that was still in that list, and the next process-wide toplevel walk — a language or text-direction switch, the theme, the inspector — read freed memory: GLib CRITICALs, then a crash, or a use-after-free when GTK destroyed a window whose wrapper was still alive. Both initializers now take their own reference before the wrapper takes over, so a released wrapper leaves the window alive in the list, and the window finalizes exactly once, when both GTK and Swift have let go.

present() no longer adds an extra retain, and retainUntilClose() is a no-op on windows. The wrapper's own reference already keeps a window alive until gtk_window_destroy drops GTK's reference, so the strong capture present() used to install would be a reference cycle ("destroy" fires only at the last unref). Closing or destroying a window now frees it, and an explicit retainUntilClose() on a window is harmless.


Full Changelog: 2.0.1...2.0.2