[libgdata: 20/22] core: Fix various minor mutex abuses



commit a7346660e2b60f338fe225bc12ad1addbc19912c
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Sep 17 23:01:04 2014 +0100

    core: Fix various minor mutex abuses
    
    GLib has recently got stricter about abusing mutexes, and now no longer
    allows:
     • Clearing a locked mutex.
     • Unlocking a non-locked mutex.
    Both of which libgdata was doing, and now does no longer.

 gdata/gdata-service.c       |    7 ++++++-
 gdata/gdata-upload-stream.c |    1 -
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 8ac96ed..afcacd0 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -652,8 +652,13 @@ _gdata_service_actually_send_message (SoupSession *session, SoupMessage *message
         * sent. */
        if (cancellable == NULL || g_cancellable_is_cancelled (cancellable) == FALSE)
                soup_session_send_message (session, message);
-       else
+       else {
+               if (cancellable != NULL) {
+                       g_mutex_unlock (&data.mutex);
+               }
+
                soup_message_set_status (message, SOUP_STATUS_CANCELLED);
+       }
 
        /* Clean up the cancellation code */
        if (cancellable != NULL) {
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index 5043e0f..ce98545 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -1238,7 +1238,6 @@ finished_outer:
        g_mutex_unlock (&(priv->write_mutex));
 
        g_cond_signal (&(priv->finished_cond));
-       g_mutex_unlock (&(priv->response_mutex));
 
        /* Referenced in create_network_thread(). */
        g_object_unref (self);


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