Commit a4c70065 authored by Dan Winship's avatar Dan Winship
Browse files

connection-editor: Fix reparenting of GtkBuilder widgets

Don't use gtk_widget_unparent(); it's only meant to be used as part of
a gtk_container_remove() implementation. Calling it on someone else's
child leaves the parent in a confused state (where it still thinks the
widget is its child, but it isn't holding a ref on it).
parent fb6cd6e5
......@@ -566,7 +566,7 @@ static void
page_initialized (CEPage *page, GError *error, gpointer user_data)
NMConnectionEditor *editor = NM_CONNECTION_EDITOR (user_data);
GtkWidget *widget;
GtkWidget *widget, *parent;
GtkNotebook *notebook;
GtkWidget *label;
......@@ -580,7 +580,9 @@ page_initialized (CEPage *page, GError *error, gpointer user_data)
notebook = GTK_NOTEBOOK (gtk_builder_get_object (editor->builder, "notebook"));
label = gtk_label_new (ce_page_get_title (page));
widget = ce_page_get_page (page);
gtk_widget_unparent (widget);
parent = gtk_widget_get_parent (widget);
if (parent)
gtk_container_remove (GTK_CONTAINER (parent), widget);
gtk_notebook_append_page (notebook, widget, label);
/* Move the page from the initializing list to the main page list */
......@@ -73,6 +73,7 @@ finish_setup (CEPageWiredSecurity *self, gpointer unused, GError *error, gpointe
CEPage *parent = CE_PAGE (self);
CEPageWiredSecurityPrivate *priv = CE_PAGE_WIRED_SECURITY_GET_PRIVATE (self);
GtkWidget *parent_container;
if (error)
......@@ -85,7 +86,9 @@ finish_setup (CEPageWiredSecurity *self, gpointer unused, GError *error, gpointe
wireless_security_set_changed_notify (priv->security, stuff_changed, self);
priv->security_widget = wireless_security_get_widget (priv->security);
gtk_widget_unparent (priv->security_widget);
parent_container = gtk_widget_get_parent (priv->security_widget);
if (parent_container)
gtk_container_remove (GTK_CONTAINER (parent_container), priv->security_widget);
gtk_toggle_button_set_active (priv->enabled, priv->initial_have_8021x);
g_signal_connect (priv->enabled, "toggled", G_CALLBACK (enable_toggled), self);
......@@ -155,11 +155,13 @@ wireless_security_combo_changed (GtkComboBox *combo,
sec = wireless_security_combo_get_active (self);
if (sec) {
GtkWidget *sec_widget;
GtkWidget *widget;
GtkWidget *widget, *parent;
sec_widget = wireless_security_get_widget (sec);
g_assert (sec_widget);
gtk_widget_unparent (sec_widget);
parent = gtk_widget_get_parent (sec_widget);
if (parent)
gtk_container_remove (GTK_CONTAINER (parent), sec_widget);
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (self)->builder, "wireless_security_combo_label"));
gtk_size_group_add_widget (self->group, widget);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment