[gtk+/wip/baedert/gtk-widget-destroy: 148/149] nativedialog: Do not ref the transient_for parent
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtk-widget-destroy: 148/149] nativedialog: Do not ref the transient_for parent
- Date: Sat, 7 Oct 2017 06:04:43 +0000 (UTC)
commit 23f9a2fc33b21368843661f78bd42705dbe82ea4
Author: Timm Bäder <mail baedert org>
Date: Wed Sep 27 20:29:07 2017 +0200
nativedialog: Do not ref the transient_for parent
gtk_window_set_transient_for does not ref its parent either. This is
important because a child widget of the parent might be the one calling
thsi function.
gtk/gtknativedialog.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtknativedialog.c b/gtk/gtknativedialog.c
index 6e1a0ec..ff7a230 100644
--- a/gtk/gtknativedialog.c
+++ b/gtk/gtknativedialog.c
@@ -535,8 +535,20 @@ gtk_native_dialog_set_transient_for (GtkNativeDialog *self,
g_return_if_fail (GTK_IS_NATIVE_DIALOG (self));
- if (g_set_object (&priv->transient_for, parent))
- g_object_notify_by_pspec (G_OBJECT (self), native_props[PROP_TRANSIENT_FOR]);
+ if (parent == priv->transient_for)
+ return;
+
+ if (parent)
+ {
+ g_signal_connect (parent, "destroy", G_CALLBACK (gtk_widget_destroyed), &priv->transient_for);
+ priv->transient_for = parent;
+ }
+ else
+ {
+ g_clear_object (&priv->transient_for);
+ }
+
+ g_object_notify_by_pspec (G_OBJECT (self), native_props[PROP_TRANSIENT_FOR]);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]