mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
wayland/surface: Only call destroy func when available
When calling gdk_wayland_surface_export_handle(), if we pass some 'user_data' but no 'destroy_func', GTK4 crashes. That's because in xdg_exported_handle() we are unconditionally calling destroy_func -- even when it's NULL. Fix that by checking if there's a destroy function before calling it. Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2179
This commit is contained in:
parent
bcea96528a
commit
655c9dd526
@ -4063,8 +4063,11 @@ xdg_exported_handle (void *data,
|
|||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
|
|
||||||
impl->exported.callback (surface, handle, impl->exported.user_data);
|
impl->exported.callback (surface, handle, impl->exported.user_data);
|
||||||
|
if (impl->exported.destroy_func)
|
||||||
|
{
|
||||||
g_clear_pointer (&impl->exported.user_data,
|
g_clear_pointer (&impl->exported.user_data,
|
||||||
impl->exported.destroy_func);
|
impl->exported.destroy_func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zxdg_exported_v1_listener xdg_exported_listener = {
|
static const struct zxdg_exported_v1_listener xdg_exported_listener = {
|
||||||
|
Loading…
Reference in New Issue
Block a user