]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[script] Reference this if function is called with current object as this
authorCharlie Brej <cbrej@cs.man.ac.uk>
Fri, 2 Apr 2010 16:24:07 +0000 (17:24 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Fri, 2 Apr 2010 16:24:07 +0000 (17:24 +0100)
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

index 702f8f7a56403e1711d28dfee5b0ced9ddce9df3..6abd3a68ddaabe70ad45e53bc6f8d51fb930e7a3 100644 (file)
@@ -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);