[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.
This commit is contained in:
Charlie Brej 2010-04-02 17:24:07 +01:00
parent e588785758
commit 417beaca9b

View 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);