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



commit f31eb95907f2594fe5fcb744d95cf543c28f5e63
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 7f9bb4b..8a5428c 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2025,7 +2025,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;
@@ -2039,6 +2039,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]