region: Fix memory leaks and destroy dialogue properly
There's no top-level dialogue any more, so we need some way to clean up after ourselves.
This commit is contained in:
parent
cc172a4754
commit
0c8dd1aebc
2 changed files with 9 additions and 5 deletions
|
@ -65,6 +65,8 @@ cc_region_panel_dispose (GObject * object)
|
|||
CcRegionPanelPrivate *priv = CC_REGION_PANEL (object)->priv;
|
||||
|
||||
if (priv->builder) {
|
||||
GtkBuilder *dialog = priv->builder;
|
||||
gtk_widget_destroy (WID ("region_notebook"));
|
||||
g_object_unref (priv->builder);
|
||||
priv->builder = NULL;
|
||||
}
|
||||
|
|
|
@ -99,13 +99,16 @@ setup_model_entry (GtkBuilder * dialog)
|
|||
}
|
||||
|
||||
static void
|
||||
cleanup_xkb_tabs (GtkBuilder * dialog)
|
||||
cleanup_xkb_tabs (GtkBuilder * dialog,
|
||||
GObject *where_the_object_wa)
|
||||
{
|
||||
g_message ("cleanup_xkb_tabs running");
|
||||
|
||||
gkbd_desktop_config_term (&desktop_config);
|
||||
gkbd_keyboard_config_term (&initial_config);
|
||||
g_object_unref (G_OBJECT (config_registry));
|
||||
config_registry = NULL;
|
||||
g_object_unref (G_OBJECT (engine));
|
||||
/* Don't unref it here, or we'll crash if open the panel again */
|
||||
engine = NULL;
|
||||
g_object_unref (G_OBJECT (xkb_keyboard_settings));
|
||||
g_object_unref (G_OBJECT (xkb_desktop_settings));
|
||||
|
@ -225,9 +228,8 @@ setup_xkb_tabs (GtkBuilder * dialog)
|
|||
xkb_layouts_register_conf_listener (dialog);
|
||||
xkb_options_register_conf_listener (dialog);
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("region_dialog")),
|
||||
"destroy", G_CALLBACK (cleanup_xkb_tabs),
|
||||
dialog);
|
||||
g_object_weak_ref (G_OBJECT (WID ("region_notebook")),
|
||||
(GWeakNotify) cleanup_xkb_tabs, dialog);
|
||||
|
||||
enable_disable_restoring (dialog);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue