Commit 4e3ca5dc authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

wplua: ref closure before invalidating it

invalidation may destroy the closure and this will trigger
_wplua_closure_finalize(), which will remove the closure from the
array while the original code is also trying to do the same

if we destroy the closure after it has been removed from the
array, _wplua_closure_finalize() will not remove anything and
will continue happily
parent ac23e602
......@@ -33,8 +33,10 @@ _wplua_closure_store_finalize (WpLuaClosureStore * self)
{
for (guint i = self->closures->len; i > 0; i--) {
GClosure *c = g_ptr_array_index (self->closures, i-1);
g_closure_ref (c);
g_closure_invalidate (c);
g_ptr_array_remove_index_fast (self->closures, i-1);
g_closure_unref (c);
}
g_ptr_array_unref (self->closures);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment