[libgda] GdaConnection: correction when GDA_CONNECTION_OPTIONS_THREAD_SAFE is used



commit 9804a03ae600a0c55270dbc6fe31be3f3c125c25
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sat Sep 12 10:26:24 2009 +0200

    GdaConnection: correction when GDA_CONNECTION_OPTIONS_THREAD_SAFE is used
    
    signals would not correctly be emitted

 libgda/gda-connection.c                     |    7 +------
 libgda/thread-wrapper/gda-thread-provider.c |    8 ++++++++
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 2360e47..59592db 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -691,12 +691,6 @@ gda_connection_set_property (GObject *object,
 					ThreadConnectionData *cdata = NULL;
 					cdata = (ThreadConnectionData*) gda_connection_internal_get_provider_data (cnc);
 					if (cdata) {
-						gint i;
-						for (i = 0; i < cdata->handlers_ids->len; i++) {
-							gulong id;
-							id = g_array_index (cdata->handlers_ids, gulong, i);
-							gda_thread_wrapper_steal_signal (cdata->wrapper, id);
-						}
 						cnc->priv->monitor_id = g_timeout_add_seconds (1,
 											       (GSourceFunc) monitor_wrapped_cnc,
 											       cdata->wrapper);
@@ -2039,6 +2033,7 @@ gda_connection_async_statement_execute (GdaConnection *cnc, GdaStatement *stmt,
 	g_return_val_if_fail (GDA_IS_STATEMENT (stmt), 0);
 	g_return_val_if_fail (PROV_CLASS (cnc->priv->provider_obj)->statement_execute, 0);
 
+
 	if (! gda_connection_trylock ((GdaLockable*) cnc)) {
 		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_CANT_LOCK_ERROR,
 			     _("Can't obtain connection lock"));
diff --git a/libgda/thread-wrapper/gda-thread-provider.c b/libgda/thread-wrapper/gda-thread-provider.c
index ec1cde4..b547263 100644
--- a/libgda/thread-wrapper/gda-thread-provider.c
+++ b/libgda/thread-wrapper/gda-thread-provider.c
@@ -1503,6 +1503,14 @@ gda_thread_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
 	cdata = (ThreadConnectionData*) gda_connection_internal_get_provider_data (cnc);
 	if (!cdata) 
 		return FALSE;
+
+	/* steal signals for current thread */
+	gint i;
+	for (i = 0; i < cdata->handlers_ids->len; i++) {
+		gulong id;
+		id = g_array_index (cdata->handlers_ids, gulong, i);
+		gda_thread_wrapper_steal_signal (cdata->wrapper, id);
+	}
 	
 	if (async_cb) {
 		ExecuteStatementData *wdata;



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