[yelp] Fixed search crash on 64-bit, didn't #include header



commit 7558d40a73d0e8d986e2e9611a55a3b768edcb0a
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Jun 24 15:13:35 2011 -0400

    Fixed search crash on 64-bit, didn't #include header
    
    If you don't #include the header, the default return type is int,
    which truncates the pointer on 64-bit systems, which crashes.

 libyelp/yelp-docbook-document.c |    1 +
 libyelp/yelp-mallard-document.c |    1 +
 libyelp/yelp-storage.c          |    3 +++
 3 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index 479597b..b7e3a98 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -34,6 +34,7 @@
 #include "yelp-docbook-document.h"
 #include "yelp-error.h"
 #include "yelp-settings.h"
+#include "yelp-storage.h"
 #include "yelp-transform.h"
 #include "yelp-debug.h"
 
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 2c62a7f..5ce5f17 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -34,6 +34,7 @@
 #include "yelp-error.h"
 #include "yelp-mallard-document.h"
 #include "yelp-settings.h"
+#include "yelp-storage.h"
 #include "yelp-transform.h"
 #include "yelp-debug.h"
 
diff --git a/libyelp/yelp-storage.c b/libyelp/yelp-storage.c
index 97a1786..e369f42 100644
--- a/libyelp/yelp-storage.c
+++ b/libyelp/yelp-storage.c
@@ -42,8 +42,11 @@ yelp_storage_set_default (YelpStorage *storage)
 YelpStorage *
 yelp_storage_get_default (void)
 {
+    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+    g_static_mutex_lock (&mutex);
     if (default_storage == NULL)
         default_storage = yelp_sqlite_storage_new (":memory:");
+    g_static_mutex_unlock (&mutex);
     return default_storage;
 }
 



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