From 417beaca9b0d64a1e91e9e721dff8c86ce5af8eb Mon Sep 17 00:00:00 2001 From: Charlie Brej Date: Fri, 2 Apr 2010 17:24:07 +0100 Subject: [PATCH] [script] Reference this if function is called with current object as this If calling a function which is connected to the current object, the object operated on in the function call is the current object. This is rarely used and somehow survived without causing crashes despite incorrectly not increasing the refcount. --- src/plugins/splash/script/script-execute.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/splash/script/script-execute.c b/src/plugins/splash/script/script-execute.c index 702f8f7a..6abd3a68 100644 --- a/src/plugins/splash/script/script-execute.c +++ b/src/plugins/splash/script/script-execute.c @@ -324,7 +324,10 @@ static script_obj_t *script_evaluate_func (script_state_t *state, { func_obj = script_obj_hash_peek_element (state->this, name); if (func_obj) - this_obj = state->this; + { + this_obj = state->this; + script_obj_ref(this_obj); + } else { func_obj = script_obj_hash_peek_element (state->global, name);