[gnome-software/gnome-3-22] trivial: Fix a deadlock when setting the origin multiple times



commit eb25191d77e4fdbf0fc8e4c59396e5e2d51b201e
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jan 10 16:21:28 2017 +0000

    trivial: Fix a deadlock when setting the origin multiple times

 src/gs-app.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 9b1cde8..940771d 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1933,7 +1933,7 @@ gs_app_get_origin (GsApp *app)
 void
 gs_app_set_origin (GsApp *app, const gchar *origin)
 {
-       g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&app->mutex);
+       g_autoptr(GMutexLocker) locker = NULL;
        g_return_if_fail (GS_IS_APP (app));
        if (origin == app->origin)
                return;
@@ -1947,6 +1947,7 @@ gs_app_set_origin (GsApp *app, const gchar *origin)
                return;
        }
 
+       locker = g_mutex_locker_new (&app->mutex);
        g_free (app->origin);
        app->origin = g_strdup (origin);
 


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