[evolution] message_list_regen_done_cb: Fix a runtime warning.



commit 9aca198838a55891b4aa28d522e106e77a6c39fb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 14 09:27:43 2013 -0400

    message_list_regen_done_cb: Fix a runtime warning.
    
    Make sure we're using our own RegenData structure.  Still clear the
    reference on the private structure if it matches what we get from our
    GSimpleAsyncResult.  The idea is to ensure we have exclusive access to
    it so we don't have to worry about locking, etc.

 mail/message-list.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index ecd2942..4977a97 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -4717,29 +4717,30 @@ message_list_regen_done_cb (GObject *source_object,
 
        message_list = MESSAGE_LIST (source_object);
        simple = G_SIMPLE_ASYNC_RESULT (result);
+       regen_data = g_simple_async_result_get_op_res_gpointer (simple);
 
-       /* Steal the MessageList's RegenData pointer.
-        * We should have exclusive access to it now. */
+       /* Withdraw our RegenData from the private struct, if it hasn't
+        * already been replaced.  We have exclusive access to it now. */
        g_mutex_lock (&message_list->priv->regen_lock);
-       regen_data = message_list->priv->regen_data;
-       message_list->priv->regen_data = NULL;
+       if (message_list->priv->regen_data == regen_data) {
+               regen_data_unref (message_list->priv->regen_data);
+               message_list->priv->regen_data = NULL;
+       }
        g_mutex_unlock (&message_list->priv->regen_lock);
 
-       g_return_if_fail (regen_data != NULL);
-
        activity = regen_data->activity;
 
        g_simple_async_result_propagate_error (simple, &local_error);
 
        if (e_activity_handle_cancellation (activity, local_error)) {
                g_error_free (local_error);
-               goto exit;
+               return;
 
        /* FIXME This should be handed off to an EAlertSink. */
        } else if (local_error != NULL) {
                g_warning ("%s: %s", G_STRFUNC, local_error->message);
                g_error_free (local_error);
-               goto exit;
+               return;
        }
 
        e_activity_set_state (activity, E_ACTIVITY_COMPLETED);
@@ -4880,9 +4881,6 @@ message_list_regen_done_cb (GObject *source_object,
                message_list_signals[MESSAGE_LIST_BUILT], 0);
 
        message_list->priv->any_row_changed = FALSE;
-
-exit:
-       regen_data_unref (regen_data);
 }
 
 static gboolean


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