[evolution-data-server] CamelOperation: Try to avoid crashing on refcount errors.



commit 0cfa295313253f721810ede126fd9e09deb46c46
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Oct 7 12:27:52 2010 -0400

    CamelOperation: Try to avoid crashing on refcount errors.
    
    Sanity check the StatusNode passed to the idle callback so that we emit
    a runtime warning rather than crash if the CamelOperation has already
    been finalized.

 camel/camel-operation.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 926dbd4..88ee3e5 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -90,6 +90,10 @@ operation_emit_status_cb (StatusNode *node)
 	gchar *message = NULL;
 	gint percent = 0;
 
+	/* Guard against reference counting errors. */
+	g_return_val_if_fail (node != NULL, FALSE);
+	g_return_val_if_fail (CAMEL_IS_OPERATION (node->operation), FALSE);
+
 	/* Keep the operation alive until we emit the signal,
 	 * otherwise it might be finalized between unlocking
 	 * the mutex and emitting the signal. */



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