[gtk+] csd: Properly dispose custom titlebars
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] csd: Properly dispose custom titlebars
- Date: Mon, 13 May 2013 01:01:27 +0000 (UTC)
commit 7052d4071cff1bbbebb58b867e364a231e4dc841
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 12 20:58:48 2013 -0400
csd: Properly dispose custom titlebars
gtk_bin_remove can't handle internal children, so we have
to unset the titlebar widget before chaining up in dispose.
https://bugzilla.gnome.org/show_bug.cgi?id=700054
gtk/gtkwindow.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 12bfd6f..4a4e1f3 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -540,6 +540,7 @@ static void gtk_window_buildable_custom_finished (GtkBuildable *buildable,
gpointer user_data);
static void ensure_state_flag_backdrop (GtkWidget *widget);
+static void unset_titlebar (GtkWindow *window);
G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
@@ -2547,6 +2548,7 @@ gtk_window_dispose (GObject *object)
gtk_window_set_focus (window, NULL);
gtk_window_set_default (window, NULL);
+ unset_titlebar (window);
remove_attach_widget (GTK_WINDOW (object));
@@ -3437,6 +3439,22 @@ gtk_window_set_geometry_hints (GtkWindow *window,
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
}
+static void
+unset_titlebar (GtkWindow *window)
+{
+ GtkWindowPrivate *priv = window->priv;
+
+ if (priv->title_box != NULL)
+ {
+ gtk_widget_unparent (priv->title_box);
+ priv->title_box = NULL;
+ priv->title_icon = NULL;
+ priv->title_min_button = NULL;
+ priv->title_max_button = NULL;
+ priv->title_close_button = NULL;
+ }
+}
+
/**
* gtk_window_set_titlebar:
* @window: a #GtkWindow
@@ -3462,15 +3480,7 @@ gtk_window_set_titlebar (GtkWindow *window,
g_return_if_fail (GTK_IS_WINDOW (window));
- if (priv->title_box != NULL)
- {
- gtk_widget_unparent (priv->title_box);
- priv->title_box = NULL;
- priv->title_icon = NULL;
- priv->title_min_button = NULL;
- priv->title_max_button = NULL;
- priv->title_close_button = NULL;
- }
+ unset_titlebar (window);
priv->custom_title = TRUE;
priv->title_box = titlebar;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]