Skip to content

object: Add special case for destroying GdkSurface

Philip Chimento requested to merge ptomato/gjs:592-gdksurface into master

GdkSurface needs to have gdk_surface_destroy() called on it when user code is finished with it, rather than g_object_unref(). Otherwise, the user gets a warning about losing the last reference to an undestroyed surface.

GdkSurface should in theory not behave like this, but needs to because of the X11 backend. See gtk#6289 (closed).

This adds a workaround which checks, hopefully in a performant way, if the native GObject pointer to be released is a GdkSurface or subclass. If it is, we call gdk_surface_destroy() on it (via introspection) rather than letting the smart pointer's destructor call g_object_unref() on it.

Closes: #592 (closed)

Merge request reports