[anjuta] symbol-db: fixed double free on plugin deactivating.
- From: Massimo Cora' <mcora src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: fixed double free on plugin deactivating.
- Date: Thu, 28 Jan 2010 23:34:45 +0000 (UTC)
commit 071c004c368a7886f672136b53c9bba77ba73e88
Author: Massimo Corà <mcora src gnome org>
Date: Fri Jan 29 00:29:14 2010 +0100
symbol-db: fixed double free on plugin deactivating.
This bug was causing random crashes after projects loading/unloading.
plugins/symbol-db/plugin.c | 13 ++++++++-----
plugins/symbol-db/symbol-db-engine-core.c | 4 +++-
plugins/symbol-db/symbol-db-engine-utils.c | 4 ++--
plugins/symbol-db/symbol-db-view-locals.c | 12 ++++++++++--
plugins/symbol-db/symbol-db-view-search.c | 4 ++--
plugins/symbol-db/symbol-db-view.c | 8 ++++++++
6 files changed, 33 insertions(+), 12 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 30cef36..fc0543c 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -2615,8 +2615,11 @@ symbol_db_deactivate (AnjutaPlugin *plugin)
}
/* destroy objects */
- if (sdb_plugin->sdbe_project)
+ if (sdb_plugin->sdbe_project)
+ {
+ DEBUG_PRINT ("Destroying project engine object. ");
g_object_unref (sdb_plugin->sdbe_project);
+ }
sdb_plugin->sdbe_project = NULL;
/* this must be done *before* destroying sdbe_globals */
@@ -2625,7 +2628,8 @@ symbol_db_deactivate (AnjutaPlugin *plugin)
g_free (sdb_plugin->current_scanned_package);
sdb_plugin->current_scanned_package = NULL;
-
+
+ DEBUG_PRINT ("Destroying global engine object. ");
g_object_unref (sdb_plugin->sdbe_globals);
sdb_plugin->sdbe_globals = NULL;
@@ -2672,8 +2676,6 @@ symbol_db_deactivate (AnjutaPlugin *plugin)
anjuta_ui_unmerge (sdb_plugin->ui, sdb_plugin->merge_id);
/* Remove widgets: Widgets will be destroyed when dbv_main is removed */
- g_object_unref (sdb_plugin->progress_bar_project);
- g_object_unref (sdb_plugin->progress_bar_system);
anjuta_shell_remove_widget (plugin->shell, sdb_plugin->dbv_main, NULL);
sdb_plugin->root_watch_id = 0;
@@ -2696,7 +2698,7 @@ symbol_db_deactivate (AnjutaPlugin *plugin)
static void
symbol_db_finalize (GObject *obj)
{
- DEBUG_PRINT ("%s", "Symbol-DB finalize");
+ DEBUG_PRINT ("Symbol-DB finalize");
/* Finalization codes here */
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -2704,6 +2706,7 @@ symbol_db_finalize (GObject *obj)
static void
symbol_db_dispose (GObject *obj)
{
+ DEBUG_PRINT ("Symbol-DB dispose");
/* Disposition codes */
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 0b004f5..4ff7753 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -2494,7 +2494,9 @@ sdb_engine_finalize (GObject * object)
if (priv->timeout_trigger_handler > 0)
g_source_remove (priv->timeout_trigger_handler);
- sdb_engine_disconnect_from_db (dbe);
+ if (symbol_db_engine_is_connected (dbe) == TRUE)
+ sdb_engine_disconnect_from_db (dbe);
+
sdb_engine_free_cached_queries (dbe);
sdb_engine_free_cached_dynamic_queries (dbe);
diff --git a/plugins/symbol-db/symbol-db-engine-utils.c b/plugins/symbol-db/symbol-db-engine-utils.c
index 98bb8cd..30a4665 100644
--- a/plugins/symbol-db/symbol-db-engine-utils.c
+++ b/plugins/symbol-db/symbol-db-engine-utils.c
@@ -250,8 +250,8 @@ symbol_db_util_get_pixbuf (const gchar *node_type, const gchar *node_access)
sdb_util_load_symbol_pixbufs ();
}
- /*DEBUG_PRINT ("symbol_db_view_get_pixbuf: node_type %s node_access %s",
- node_type, node_access);*/
+ DEBUG_PRINT ("symbol_db_view_get_pixbuf: node_type %s node_access %s",
+ node_type, node_access);
g_return_val_if_fail (node_type != NULL, NULL);
diff --git a/plugins/symbol-db/symbol-db-view-locals.c b/plugins/symbol-db/symbol-db-view-locals.c
index 4bfc0cf..eef2387 100644
--- a/plugins/symbol-db/symbol-db-view-locals.c
+++ b/plugins/symbol-db/symbol-db-view-locals.c
@@ -353,13 +353,20 @@ sdb_view_locals_finalize (GObject *object)
locals = SYMBOL_DB_VIEW_LOCALS (object);
priv = locals->priv;
- /*DEBUG_PRINT ("%s", "finalizing symbol_db_view_locals ()");*/
+ DEBUG_PRINT ("%s", "finalizing symbol_db_view_locals ()");
symbol_db_view_locals_clear_cache (locals);
g_hash_table_destroy (priv->files_view_status);
g_free (priv);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+sdb_view_locals_dispose (GObject *object)
+{
+ /*DEBUG_PRINT ("sdb_view_locals_dispose ");*/
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@@ -369,6 +376,7 @@ sdb_view_locals_class_init (SymbolDBViewLocalsClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = sdb_view_locals_finalize;
+ object_class->dispose = sdb_view_locals_dispose;
}
GType
diff --git a/plugins/symbol-db/symbol-db-view-search.c b/plugins/symbol-db/symbol-db-view-search.c
index 1048976..8a74144 100644
--- a/plugins/symbol-db/symbol-db-view-search.c
+++ b/plugins/symbol-db/symbol-db-view-search.c
@@ -550,7 +550,7 @@ sdb_view_search_dispose (GObject * obj)
SymbolDBViewSearch *search = SYMBOL_DB_VIEW_SEARCH (obj);
SymbolDBViewSearchPriv *priv = search->priv;
- DEBUG_PRINT("%s", "Destroying symbolsearch");
+ /*DEBUG_PRINT("sdb_view_search_dispose ");*/
if (priv->entry)
g_signal_handlers_disconnect_by_func (G_OBJECT(priv->entry),
@@ -591,7 +591,7 @@ sdb_view_search_dispose (GObject * obj)
if (priv->hitlist)
priv->hitlist = NULL;
- G_OBJECT_CLASS (parent_class)->dispose (obj);
+ G_OBJECT_CLASS (parent_class)->dispose (obj);
}
diff --git a/plugins/symbol-db/symbol-db-view.c b/plugins/symbol-db/symbol-db-view.c
index 053c21f..f8f9785 100644
--- a/plugins/symbol-db/symbol-db-view.c
+++ b/plugins/symbol-db/symbol-db-view.c
@@ -1447,6 +1447,13 @@ sdb_view_finalize (GObject *object)
}
static void
+sdb_view_dispose (GObject *object)
+{
+ /*DEBUG_PRINT ("sdb_view_dispose ");*/
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
sdb_view_class_init (SymbolDBViewClass *klass)
{
SymbolDBViewClass *sdbc;
@@ -1455,6 +1462,7 @@ sdb_view_class_init (SymbolDBViewClass *klass)
sdbc = SYMBOL_DB_VIEW_CLASS (klass);
object_class->finalize = sdb_view_finalize;
+ object_class->dispose = sdb_view_dispose;
}
GType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]