[anjuta: 4/4] symbol-db: #585498 – Completion stop working and strange warning
- From: Massimo Cora' <mcora src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta: 4/4] symbol-db: #585498 – Completion stop working and strange warning
- Date: Wed, 17 Jun 2009 16:02:09 -0400 (EDT)
commit c77341f2d80cfb0b4eee4556306f2a415a857e2a
Author: Massimo Corà <mcora src gnome org>
Date: Wed Jun 17 22:00:13 2009 +0200
symbol-db: #585498 â?? Completion stop working and strange warning
dynamic queries were eating all the objects in the pool, causing NULL statements to be processed.
plugins/symbol-db/symbol-db-engine-core.c | 56 +++++++++++++++++-----------
plugins/symbol-db/symbol-db-engine-priv.h | 5 ++-
2 files changed, 37 insertions(+), 24 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 94d9c2b..62a0ab4 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -492,11 +492,7 @@ sdb_engine_dyn_child_query_node_destroy (gpointer data)
g_free (node_to_destroy);
}
-/**
- * WARNING: We suppose that before calling this function we already checked with
- * sdb_engine_get_dyn_query_node_by_id () that the node we're going to add
- * isn't yet inserted.
- */
+
GNUC_INLINE const DynChildQueryNode *
sdb_engine_insert_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type query_id,
SymExtraInfo sym_info, gsize other_parameters,
@@ -541,7 +537,15 @@ sdb_engine_insert_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type quer
* will be ignored
*/
DynChildQueryNode *dyn_node;
-
+
+ /* check if a DynChildQueryNode already exists in the gtree */
+ if ( (dyn_node = g_tree_lookup (node->sym_extra_info_gtree,
+ GINT_TO_POINTER (sym_info))) == NULL)
+ {
+ /* strange enough but we found something. Return it. */
+ return dyn_node;
+ }
+
dyn_node = g_new0 (DynChildQueryNode, 1);
/* create a new GdaStatement */
@@ -569,18 +573,27 @@ sdb_engine_insert_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type quer
/* ok, this is a slightly more complex case */
GTree *child_gtree;
DynChildQueryNode *dyn_node;
+ gboolean insert_into_main = FALSE;
- child_gtree = g_tree_new_full ((GCompareDataFunc)&symbol_db_gtree_compare_func,
- NULL,
- NULL,
- sdb_engine_dyn_child_query_node_destroy);
-
+ if ((child_gtree = g_tree_lookup (node->sym_extra_info_gtree,
+ GINT_TO_POINTER (sym_info))) != NULL)
+ {
+ insert_into_main = FALSE;
+ }
+ else {
+ /* creating a new child_gtree.... */
+ insert_into_main = TRUE;
+ child_gtree = g_tree_new_full ((GCompareDataFunc)&symbol_db_gtree_compare_func,
+ NULL,
+ NULL,
+ sdb_engine_dyn_child_query_node_destroy);
+ }
+
dyn_node = g_new0 (DynChildQueryNode, 1);
/* create a new GdaStatement */
dyn_node->plist = NULL;
- dyn_node->stmt =
- gda_sql_parser_parse_string (priv->sql_parser, sql, NULL,
+ dyn_node->stmt = gda_sql_parser_parse_string (priv->sql_parser, sql, NULL,
NULL);
if (gda_statement_get_parameters ((GdaStatement*)dyn_node->stmt,
@@ -590,16 +603,15 @@ sdb_engine_insert_dyn_query_node_by_id (SymbolDBEngine *dbe, dyn_query_type quer
}
dyn_node->query_str = g_strdup (sql);
-
-/*
- DEBUG_PRINT ("inserting child into main_gtree's gtree child, "
- "other_parameters %d, sym_info %d, dyn_node %p",
- other_parameters, sym_info, dyn_node);
-*/
- /* insert the dyn_node into child_gtree, then child_gtree into main_gtree */
+
+ /* insert the dyn_node into child_gtree, then child_gtree into main_gtree */
g_tree_insert (child_gtree, GINT_TO_POINTER (other_parameters), dyn_node);
-
- g_tree_insert (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info), child_gtree);
+
+ if (insert_into_main == TRUE)
+ {
+ g_tree_insert (node->sym_extra_info_gtree, GINT_TO_POINTER (sym_info),
+ child_gtree);
+ }
/* return it */
return dyn_node;
diff --git a/plugins/symbol-db/symbol-db-engine-priv.h b/plugins/symbol-db/symbol-db-engine-priv.h
index 45b0886..d957f1c 100644
--- a/plugins/symbol-db/symbol-db-engine-priv.h
+++ b/plugins/symbol-db/symbol-db-engine-priv.h
@@ -81,12 +81,13 @@
#else
#define MP_LEND_OBJ_STR(sdb_priv, OUT_gvalue) \
OUT_gvalue = (GValue*)g_queue_pop_head(sdb_priv->mem_pool_string);
+ /*DEBUG_PRINT ("lend str %p, qlength %d [-]", OUT_gvalue, g_queue_get_length (sdb_priv->mem_pool_string));*/
#define MP_RETURN_OBJ_STR(sdb_priv, gvalue) \
g_value_set_static_string (gvalue, DUMMY_VOID_STRING); \
g_queue_push_head(sdb_priv->mem_pool_string, gvalue);
-
-
+ /*DEBUG_PRINT ("return str %p, qlength %d [+]", gvalue, g_queue_get_length (sdb_priv->mem_pool_string));*/
+
#define MP_LEND_OBJ_INT(sdb_priv, OUT_gvalue) \
OUT_gvalue = (GValue*)g_queue_pop_head(sdb_priv->mem_pool_int);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]