window: Use dispose instead of destroy

The destroy vfunc is going away.
This commit is contained in:
Matthias Clasen 2020-05-05 16:51:24 -04:00
parent 401f8a7f31
commit 77d15b1751

View File

@ -366,7 +366,6 @@ struct _GtkWindowGeometryInfo
static void gtk_window_constructed (GObject *object);
static void gtk_window_dispose (GObject *object);
static void gtk_window_finalize (GObject *object);
static void gtk_window_destroy (GtkWidget *widget);
static void gtk_window_show (GtkWidget *widget);
static void gtk_window_hide (GtkWidget *widget);
static void gtk_window_map (GtkWidget *widget);
@ -501,6 +500,8 @@ static GdkToplevelLayout * gtk_window_compute_layout (GtkWindow *window,
int min_width,
int min_height);
static void gtk_window_release_application (GtkWindow *window);
static GListStore *toplevel_list = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
static gchar *default_icon_name = NULL;
@ -757,7 +758,6 @@ gtk_window_class_init (GtkWindowClass *klass)
gobject_class->set_property = gtk_window_set_property;
gobject_class->get_property = gtk_window_get_property;
widget_class->destroy = gtk_window_destroy;
widget_class->show = gtk_window_show;
widget_class->hide = gtk_window_hide;
widget_class->map = gtk_window_map;
@ -2635,6 +2635,35 @@ gtk_window_dispose (GObject *object)
{
GtkWindow *window = GTK_WINDOW (object);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
guint i;
gtk_window_release_application (window);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
{
gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);
if (item == window)
{
g_list_store_remove (toplevel_list, i);
break;
}
else
g_object_unref (item);
}
if (priv->transient_parent)
gtk_window_set_transient_for (window, NULL);
remove_attach_widget (window);
if (priv->has_user_ref_count)
{
priv->has_user_ref_count = FALSE;
g_object_unref (window);
}
if (priv->group)
gtk_window_group_remove_window (priv->group, window);
g_list_free_full (priv->foci, (GDestroyNotify) gtk_pointer_focus_unref);
priv->foci = NULL;
@ -4002,44 +4031,6 @@ gtk_window_get_size (GtkWindow *window,
*height = h;
}
static void
gtk_window_destroy (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
guint i;
gtk_window_release_application (window);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
{
gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);
if (item == window)
{
g_list_store_remove (toplevel_list, i);
break;
}
else
g_object_unref (item);
}
if (priv->transient_parent)
gtk_window_set_transient_for (window, NULL);
remove_attach_widget (window);
if (priv->has_user_ref_count)
{
priv->has_user_ref_count = FALSE;
g_object_unref (window);
}
if (priv->group)
gtk_window_group_remove_window (priv->group, window);
GTK_WIDGET_CLASS (gtk_window_parent_class)->destroy (widget);
}
static gboolean
gtk_window_close_request (GtkWindow *window)
{