[evolution-mapi] Bug #607744 - Crash on MAPI notification close



commit 68a1e00151d04166d7f909046127680ceaa1630a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 8 14:20:06 2010 +0100

    Bug #607744 - Crash on MAPI notification close

 src/libexchangemapi/exchange-mapi-connection.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index ab18ad4..d277170 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -3133,11 +3133,14 @@ exchange_mapi_events_subscribe (guint32 options,
 
 	mapi_object_init(&obj_target);
 
+	LOCK ();
+
 	if (options & MAPI_EVENTS_USE_STORE) {
 		retval = OpenMsgStore(global_mapi_session, &obj_target);
 		if (retval != MAPI_E_SUCCESS) {
 			mapi_errstr("OpenMsgStore", GetLastError());
-			return false;
+			UNLOCK ();
+			return FALSE;
 		}
 	} else if (options & MAPI_EVENTS_USE_PF_STORE) {
 		/* TODO */
@@ -3148,6 +3151,8 @@ exchange_mapi_events_subscribe (guint32 options,
 	retval = Subscribe(&obj_target, connection, event_mask, use_store,
 			   (mapi_notify_callback_t) callback, data);
 
+	UNLOCK ();
+
 	return (retval == MAPI_E_SUCCESS);
 }
 
@@ -3156,11 +3161,16 @@ exchange_mapi_events_unsubscribe (guint32 connection)
 {
 	enum MAPISTATUS	retval;
 
-	if (!global_mapi_session)
+	LOCK ();
+	if (!global_mapi_session) {
+		UNLOCK ();
 		return FALSE;
+	}
 
 	retval = Unsubscribe (global_mapi_session, connection);
 
+	UNLOCK ();
+
 	return (retval == MAPI_E_SUCCESS);
 }
 
@@ -3169,7 +3179,9 @@ gboolean
 exchange_mapi_events_monitor (struct mapi_notify_continue_callback_data *cb_data)
 {
 	enum MAPISTATUS	retval;
+	LOCK ();
 	retval = MonitorNotification (global_mapi_session, NULL, cb_data);
+	UNLOCK ();
 	return retval;
 }
 



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