[gnome-color-manager] Protect gcm_client_add_device() with a mutex to try and fix a libsane-related segfault
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Protect gcm_client_add_device() with a mutex to try and fix a libsane-related segfault
- Date: Mon, 14 Jun 2010 08:57:11 +0000 (UTC)
commit 9ab1439abc2d2cf72a983969062cd17a3a679e5a
Author: Richard Hughes <richard hughsie com>
Date: Mon Jun 14 09:50:04 2010 +0100
Protect gcm_client_add_device() with a mutex to try and fix a libsane-related segfault
src/gcm-client.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index f1e051c..06b5f2c 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -1226,10 +1226,14 @@ gcm_client_add_device (GcmClient *client, GcmDevice *device, GError **error)
const gchar *device_id;
GcmDevice *device_tmp = NULL;
GPtrArray *array;
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
g_return_val_if_fail (GCM_IS_CLIENT (client), FALSE);
g_return_val_if_fail (GCM_IS_DEVICE (device), FALSE);
+ /* lock */
+ g_static_mutex_lock (&mutex);
+
/* look to see if device already exists */
device_id = gcm_device_get_id (device);
device_tmp = gcm_client_get_device_by_id (client, device_id);
@@ -1261,6 +1265,9 @@ gcm_client_add_device (GcmClient *client, GcmDevice *device, GError **error)
/* all okay */
ret = TRUE;
out:
+ /* unlock */
+ g_static_mutex_unlock (&mutex);
+
if (device_tmp != NULL)
g_object_unref (device_tmp);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]