Skip to content
Snippets Groups Projects
Commit b770cf6a authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

core: remove_global: remove object from the list before triggering the notification

This avoids being able to find the same object on the globals list
from code that is connected to the signal.
parent ca1453fe
No related branches found
No related tags found
No related merge requests found
......@@ -193,6 +193,7 @@ wp_core_remove_global (WpCore * self, GQuark key, gpointer obj)
{
gint i;
struct global_object *global;
struct global_object tmp;
g_return_if_fail (WP_IS_CORE (self));
......@@ -206,13 +207,15 @@ wp_core_remove_global (WpCore * self, GQuark key, gpointer obj)
}
if (i < self->global_objects->len) {
g_signal_emit (self, signals[SIGNAL_GLOBAL_REMOVED], key,
key, global->object);
if (global->destroy)
global->destroy (global->object);
tmp = *global;
g_ptr_array_remove_index_fast (self->global_objects, i);
g_signal_emit (self, signals[SIGNAL_GLOBAL_REMOVED], key,
key, tmp.object);
if (tmp.destroy)
tmp.destroy (tmp.object);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment