[libgda] GdaBrowser: fixed connections referencing problem



commit c499db94b41c6f635429418bc52bac6033f6b1ba
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed May 25 20:50:50 2011 +0200

    GdaBrowser: fixed connections referencing problem

 tools/browser/browser-connection.c         |    9 ++++++---
 tools/browser/browser-virtual-connection.c |    7 +++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index 2032049..08829a7 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -278,6 +278,7 @@ browser_connection_init (BrowserConnection *bcnc)
 	bcnc->priv->store_cnc = NULL;
 
 	bcnc->priv->variables = NULL;
+	/*g_print ("Created BrowserConnection %p\n", bcnc);*/
 }
 
 static void
@@ -574,6 +575,10 @@ browser_connection_dispose (GObject *object)
 		if (bcnc->priv->meta_store_signal)
 			gda_thread_wrapper_disconnect (bcnc->priv->wrapper,
 						       bcnc->priv->meta_store_signal);
+		if (bcnc->priv->transaction_status_signal)
+			gda_thread_wrapper_disconnect (bcnc->priv->wrapper,
+						       bcnc->priv->transaction_status_signal);
+
 		g_object_unref (bcnc->priv->wrapper);
 		g_free (bcnc->priv->name);
 		if (bcnc->priv->c_mstruct)
@@ -587,9 +592,6 @@ browser_connection_dispose (GObject *object)
 		if (bcnc->priv->p_mstruct_mutex)
 			g_mutex_free (bcnc->priv->p_mstruct_mutex);
 
-		if (bcnc->priv->transaction_status_signal)
-			gda_thread_wrapper_disconnect (bcnc->priv->wrapper,
-						       bcnc->priv->transaction_status_signal);
 		if (bcnc->priv->cnc)
 			g_object_unref (bcnc->priv->cnc);
 
@@ -604,6 +606,7 @@ browser_connection_dispose (GObject *object)
 
 		g_free (bcnc->priv);
 		bcnc->priv = NULL;
+		/*g_print ("Disposed BrowserConnection %p\n", bcnc);*/
 	}
 
 	/* parent class */
diff --git a/tools/browser/browser-virtual-connection.c b/tools/browser/browser-virtual-connection.c
index c20d36d..1000c21 100644
--- a/tools/browser/browser-virtual-connection.c
+++ b/tools/browser/browser-virtual-connection.c
@@ -42,6 +42,7 @@ struct _BrowserVirtualConnectionPrivate
 {
 	GtkTable    *layout_table;
 	BrowserVirtualConnectionSpecs *specs;
+	gboolean in_m_busy;
 };
 
 /* get a pointer to the parents to be able to call their destructor */
@@ -85,6 +86,8 @@ static void
 source_cnc_busy_cb (G_GNUC_UNUSED BrowserConnection *bcnc, gboolean is_busy,
 		    G_GNUC_UNUSED const gchar *reason, BrowserConnection *virtual)
 {
+	if (BROWSER_VIRTUAL_CONNECTION (virtual)->priv->in_m_busy)
+		return;
 	g_signal_emit_by_name (virtual, "busy", is_busy,
 			       is_busy ? _("Bound connection is used") : NULL);
 }
@@ -99,6 +102,8 @@ m_busy (BrowserConnection *bcnc, gboolean is_busy, const gchar *reason)
 	if (! BROWSER_VIRTUAL_CONNECTION (bcnc)->priv->specs)
 		return;
 
+	BROWSER_VIRTUAL_CONNECTION (bcnc)->priv->in_m_busy = TRUE;
+
 	for (list = BROWSER_VIRTUAL_CONNECTION (bcnc)->priv->specs->parts; list; list = list->next) {
 		BrowserVirtualConnectionPart *part;
 		part = (BrowserVirtualConnectionPart*) list->data;
@@ -117,6 +122,8 @@ m_busy (BrowserConnection *bcnc, gboolean is_busy, const gchar *reason)
 	}
 
 	BROWSER_CONNECTION_CLASS (parent_class)->busy (bcnc, is_busy, reason);
+
+	BROWSER_VIRTUAL_CONNECTION (bcnc)->priv->in_m_busy = FALSE;
 }
 
 static void



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