Created
March 5, 2014 15:43
-
-
Save Lokaltog/9369734 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/util/load_config.c b/util/load_config.c | |
index 7734f36..473cef4 100644 | |
--- a/util/load_config.c | |
+++ b/util/load_config.c | |
@@ -2,6 +2,8 @@ | |
#include "src/widgets/widgets.h" | |
#include "src/wkline.h" | |
+static GMutex m; | |
+ | |
json_t * | |
load_config_file () { | |
const char *user_config_file; | |
@@ -26,16 +28,24 @@ load_config_file () { | |
json_t * | |
wkline_get_config (struct wkline *self, const char *config_name) { | |
- return json_object_get(self->config, config_name); | |
+ g_mutex_lock(&m); | |
+ json_t *obj; | |
+ obj = json_object_get(self->config, config_name); | |
+ g_mutex_unlock(&m); | |
+ return obj; | |
} | |
json_t * | |
wkline_widget_get_config (struct widget *self, const char *config_name) { | |
- json_t *object; | |
+ g_mutex_lock(&m); | |
+ json_t *object, *obj; | |
object = json_object_get(self->config, "widgets"); | |
if (! object) { | |
wklog("config error: widgets object not found"); | |
} | |
object = json_object_get(object, self->name); | |
- return json_object_get(object, config_name); | |
+ obj = json_object_get(object, config_name); | |
+ | |
+ g_mutex_unlock(&m); | |
+ return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment