gtk: Don't drop too many references

We only have one reference to the surface,
and it is dropped by gdk_surface_destroy.

All the users of surfaces in gtk had the same
bug: they were all stealing an extra reference
to drop - the one that the renderer was leaking
until recently.
This commit is contained in:
Matthias Clasen 2023-05-10 20:19:23 -04:00
parent aee214b09d
commit 1a9c03449e
4 changed files with 4 additions and 8 deletions

View File

@ -1017,8 +1017,7 @@ gtk_popover_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (priv->surface, surface_render, widget);
g_signal_handlers_disconnect_by_func (priv->surface, surface_event, widget);
gdk_surface_set_widget (priv->surface, NULL);
gdk_surface_destroy (priv->surface);
g_clear_object (&priv->surface);
g_clear_pointer (&priv->surface, gdk_surface_destroy);
}
static gboolean

View File

@ -280,8 +280,7 @@ gtk_text_handle_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (handle->surface, surface_mapped_changed, widget);
gdk_surface_set_widget (handle->surface, NULL);
gdk_surface_destroy (handle->surface);
g_clear_object (&handle->surface);
g_clear_pointer (&handle->surface, gdk_surface_destroy);
}
static void

View File

@ -240,8 +240,7 @@ gtk_tooltip_window_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (window->surface, surface_render, widget);
g_signal_handlers_disconnect_by_func (window->surface, surface_event, widget);
gdk_surface_set_widget (window->surface, NULL);
gdk_surface_destroy (window->surface);
g_clear_object (&window->surface);
g_clear_pointer (&window->surface, gdk_surface_destroy);
}

View File

@ -4451,8 +4451,7 @@ gtk_window_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
gdk_surface_set_widget (surface, NULL);
gdk_surface_destroy (surface);
g_clear_object (&priv->surface);
g_clear_pointer (&priv->surface, gdk_surface_destroy);
}
static void