[evolution-data-server] Fix a potential race in operation_idle_cb().



commit 1282fdc2cb09d720918fa883cd07ad7adce2793f
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Sep 15 07:56:06 2010 -0400

    Fix a potential race in operation_idle_cb().

 camel/camel-operation.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 028ee29..e03702f 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -120,6 +120,11 @@ operation_idle_cb (CamelOperation *operation)
 	gchar *msg;
 	gint pc;
 
+	/* Keep the operation alive until we emit the signal,
+	 * otherwise it might be finalized between unlocking
+	 * the mutex and emitting the signal. */
+	g_object_ref (operation);
+
 	LOCK ();
 
 	msg = operation->priv->status_msg;
@@ -136,6 +141,8 @@ operation_idle_cb (CamelOperation *operation)
 		g_free (msg);
 	}
 
+	g_object_unref (operation);
+
 	return FALSE;
 }
 



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