diff options
author | portix <none@none> | 2013-02-21 11:06:32 +0100 |
---|---|---|
committer | portix <none@none> | 2013-02-21 11:06:32 +0100 |
commit | 41552e0b65152116e0ceaa42dd0c6acd6889e1bc (patch) | |
tree | 4fa2daae75757f71edce22cdf7684c3523a0935f /src/scripts.c | |
parent | acf15947de31ef454d8bb23997655846877ded52 (diff) | |
download | dwb-41552e0b65152116e0ceaa42dd0c6acd6889e1bc.zip |
Lock context mutex in scripts_eval_key
Diffstat (limited to 'src/scripts.c')
-rw-r--r-- | src/scripts.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/scripts.c b/src/scripts.c index 26cd9a76..1a2bae7f 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -931,8 +931,13 @@ scripts_eval_key(KeyMap *m, Arg *arg) else json = util_create_json(2, INTEGER, "nummod", dwb.state.nummod, CHAR, "arg", arg->p); - JSValueRef argv[] = { js_json_to_value(s_global_context, json) }; - JSObjectCallAsFunction(s_global_context, arg->js, NULL, 1, argv, NULL); + pthread_mutex_lock(&s_context_mutex); + if (s_global_context) + { + JSValueRef argv[] = { js_json_to_value(s_global_context, json) }; + JSObjectCallAsFunction(s_global_context, arg->js, NULL, 1, argv, NULL); + } + pthread_mutex_unlock(&s_context_mutex); g_free(json); return STATUS_OK; |