[gnome-software] trivial: make GsApp slightly more threadsafe
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: make GsApp slightly more threadsafe
- Date: Tue, 6 Dec 2016 15:05:44 +0000 (UTC)
commit 0f2ed60dc433f510fb47d152cadc09d392a64d3a
Author: Richard Hughes <richard hughsie com>
Date: Tue Dec 6 14:49:15 2016 +0000
trivial: make GsApp slightly more threadsafe
src/gs-app.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index d3c0dae..0028fd7 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2683,6 +2683,7 @@ gs_app_add_addon (GsApp *app, GsApp *addon)
{
gpointer found;
const gchar *id;
+ g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&app->mutex);
g_return_if_fail (GS_IS_APP (app));
g_return_if_fail (GS_IS_APP (addon));
@@ -2727,6 +2728,7 @@ gs_app_add_related (GsApp *app, GsApp *app2)
{
gchar *key;
gpointer found;
+ g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&app->mutex);
g_return_if_fail (GS_IS_APP (app));
@@ -2779,6 +2781,7 @@ gs_app_get_history (GsApp *app)
void
gs_app_add_history (GsApp *app, GsApp *app2)
{
+ g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&app->mutex);
g_return_if_fail (GS_IS_APP (app));
g_ptr_array_add (app->history, g_object_ref (app2));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]