[anjuta] build-basic-autotools: Disconnect all signals on editors when the plugin is deactivated.



commit 0542314f762758d4b0a5365b88e4f8e7d19e764d
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Fri Nov 23 15:40:48 2012 +0100

    build-basic-autotools: Disconnect all signals on editors when the plugin is deactivated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689054

 plugins/build-basic-autotools/plugin.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index ab23d02..a3d0813 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -2556,9 +2556,12 @@ activate_plugin (AnjutaPlugin *plugin)
 static gboolean
 deactivate_plugin (AnjutaPlugin *plugin)
 {
-	AnjutaUI *ui;
 	BasicAutotoolsPlugin *ba_plugin = ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin);
 
+	AnjutaUI *ui;
+	GHashTableIter iter;
+	gpointer editor;
+
 	ui = anjuta_shell_get_ui (plugin->shell, NULL);
 
 	g_signal_handlers_disconnect_by_func (plugin->shell,
@@ -2581,6 +2584,16 @@ deactivate_plugin (AnjutaPlugin *plugin)
 	/* Remove action group */
 	anjuta_ui_remove_action_group (ui, ba_plugin->build_action_group);
 	anjuta_ui_remove_action_group (ui, ba_plugin->build_popup_action_group);
+
+	/* Disconnect editor signal handlers and clear the editors hash table. */
+	g_hash_table_iter_init (&iter, ba_plugin->editors_created);
+	while (g_hash_table_iter_next (&iter, &editor, NULL))
+	{
+		g_signal_handlers_disconnect_by_func (editor, on_editor_changed, plugin);
+		g_signal_handlers_disconnect_by_func (editor, on_editor_destroy, plugin);
+	}
+	g_hash_table_remove_all (ba_plugin->editors_created);
+
 	return TRUE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]