subsurface: Avoid a crash

When finalizing a subsurface, we need to make sure it is removed
from the sibling lists in its parent, or bad things will happen.

This should crashes seen in Epiphany nightly.

Fixes: #6891
This commit is contained in:
Matthias Clasen
2024-07-29 11:53:25 -04:00
committed by Mat
parent eaa265c924
commit 325cb8071f

View File

@@ -29,11 +29,14 @@ gdk_subsurface_init (GdkSubsurface *self)
{ {
} }
static void remove_subsurface (GdkSubsurface *subsurface);
static void static void
gdk_subsurface_finalize (GObject *object) gdk_subsurface_finalize (GObject *object)
{ {
GdkSubsurface *subsurface = GDK_SUBSURFACE (object); GdkSubsurface *subsurface = GDK_SUBSURFACE (object);
remove_subsurface (subsurface);
g_ptr_array_remove (subsurface->parent->subsurfaces, subsurface); g_ptr_array_remove (subsurface->parent->subsurfaces, subsurface);
g_clear_object (&subsurface->parent); g_clear_object (&subsurface->parent);