remove "gadget_removed" smart callback from gadgets which use it upon deletion
ensure that this isn't called in a use-after-free scenario
This commit is contained in:
parent
af60915713
commit
02d8da9cd9
|
@ -1771,11 +1771,30 @@ _bar_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bar_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED)
|
_bar_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||||
|
{
|
||||||
|
Instance *inst = data;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
if (inst->o_main != event_data) return;
|
||||||
|
if (e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s", inst->cfg->dir) >= sizeof(buf))
|
||||||
|
return;
|
||||||
|
|
||||||
|
E_FREE_FUNC(inst->iconify_provider, e_comp_object_effect_mover_del);
|
||||||
|
|
||||||
|
luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg);
|
||||||
|
eina_stringshare_del(inst->cfg->style);
|
||||||
|
eina_stringshare_del(inst->cfg->dir);
|
||||||
|
E_FREE(inst->cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_bar_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Ecore_Event_Handler *handler;
|
Ecore_Event_Handler *handler;
|
||||||
|
|
||||||
|
evas_object_smart_callback_del_full(e_gadget_site_get(obj), "gadget_removed", _bar_removed_cb, inst);
|
||||||
inst->main_del = EINA_TRUE;
|
inst->main_del = EINA_TRUE;
|
||||||
_bar_empty(inst);
|
_bar_empty(inst);
|
||||||
e_object_del(E_OBJECT(inst->order));
|
e_object_del(E_OBJECT(inst->order));
|
||||||
|
@ -1886,24 +1905,6 @@ _bar_drop_enter(void *data, const char *type EINA_UNUSED, void *event_data EINA_
|
||||||
evas_object_show(inst->place_holder);
|
evas_object_show(inst->place_holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_bar_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
|
||||||
{
|
|
||||||
Instance *inst = data;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
if (inst->o_main != event_data) return;
|
|
||||||
if (e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s", inst->cfg->dir) >= sizeof(buf))
|
|
||||||
return;
|
|
||||||
|
|
||||||
E_FREE_FUNC(inst->iconify_provider, e_comp_object_effect_mover_del);
|
|
||||||
|
|
||||||
luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg);
|
|
||||||
eina_stringshare_del(inst->cfg->style);
|
|
||||||
eina_stringshare_del(inst->cfg->dir);
|
|
||||||
E_FREE(inst->cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bar_iconify_end(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
_bar_iconify_end(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -447,10 +447,26 @@ _grid_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_grid_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED)
|
_grid_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||||
|
{
|
||||||
|
Instance *inst = data;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
if (inst->o_main != event_data) return;
|
||||||
|
if (e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s", inst->cfg->dir) >= sizeof(buf))
|
||||||
|
return;
|
||||||
|
|
||||||
|
luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg);
|
||||||
|
eina_stringshare_del(inst->cfg->dir);
|
||||||
|
E_FREE(inst->cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_grid_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
|
evas_object_smart_callback_del_full(e_gadget_site_get(obj), "gadget_removed", _grid_removed_cb, inst);
|
||||||
e_object_del(E_OBJECT(inst->order));
|
e_object_del(E_OBJECT(inst->order));
|
||||||
E_FREE_FUNC(inst->drop_handler, evas_object_del);
|
E_FREE_FUNC(inst->drop_handler, evas_object_del);
|
||||||
luncher_instances = eina_list_remove(luncher_instances, inst);
|
luncher_instances = eina_list_remove(luncher_instances, inst);
|
||||||
|
@ -551,21 +567,6 @@ _grid_drop_enter(void *data, const char *type EINA_UNUSED, void *event_data EINA
|
||||||
evas_object_show(inst->place_holder);
|
evas_object_show(inst->place_holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_grid_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
|
||||||
{
|
|
||||||
Instance *inst = data;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
if (inst->o_main != event_data) return;
|
|
||||||
if (e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s", inst->cfg->dir) >= sizeof(buf))
|
|
||||||
return;
|
|
||||||
|
|
||||||
luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg);
|
|
||||||
eina_stringshare_del(inst->cfg->dir);
|
|
||||||
E_FREE(inst->cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_grid_anchor_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_grid_anchor_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,6 @@ _sysinfo_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
if (inst->o_main != event_data) return;
|
if (inst->o_main != event_data) return;
|
||||||
|
|
||||||
sysinfo_batman_remove(inst, NULL, NULL, NULL);
|
sysinfo_batman_remove(inst, NULL, NULL, NULL);
|
||||||
sysinfo_thermal_remove(inst, NULL, NULL, NULL);
|
sysinfo_thermal_remove(inst, NULL, NULL, NULL);
|
||||||
sysinfo_cpuclock_remove(inst, NULL, NULL, NULL);
|
sysinfo_cpuclock_remove(inst, NULL, NULL, NULL);
|
||||||
|
@ -23,10 +22,11 @@ _sysinfo_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sysinfo_deleted_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED)
|
_sysinfo_deleted_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
|
|
||||||
|
evas_object_smart_callback_del_full(e_gadget_site_get(obj), "gadget_removed", _sysinfo_removed_cb, inst);
|
||||||
sysinfo_batman_remove(inst, NULL, NULL, NULL);
|
sysinfo_batman_remove(inst, NULL, NULL, NULL);
|
||||||
sysinfo_thermal_remove(inst, NULL, NULL, NULL);
|
sysinfo_thermal_remove(inst, NULL, NULL, NULL);
|
||||||
sysinfo_cpuclock_remove(inst, NULL, NULL, NULL);
|
sysinfo_cpuclock_remove(inst, NULL, NULL, NULL);
|
||||||
|
|
|
@ -295,12 +295,26 @@ _clock_sizing_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *e
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clock_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_clock_gadget_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
Instance *inst = data;
|
||||||
|
|
||||||
|
if (inst->o_clock != event_info) return;
|
||||||
|
time_config->items = eina_list_remove(time_config->items, inst->cfg);
|
||||||
|
eina_stringshare_del(inst->cfg->timezone);
|
||||||
|
eina_stringshare_del(inst->cfg->time_str[0]);
|
||||||
|
eina_stringshare_del(inst->cfg->time_str[1]);
|
||||||
|
E_FREE(inst->cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clock_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Instance *inst = data;
|
Instance *inst = data;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Eina_Bool advanced = EINA_FALSE, seconds = EINA_FALSE;
|
Eina_Bool advanced = EINA_FALSE, seconds = EINA_FALSE;
|
||||||
|
|
||||||
|
evas_object_smart_callback_del_full(e_gadget_site_get(obj), "gadget_removed", _clock_gadget_removed_cb, inst);
|
||||||
clock_instances = eina_list_remove(clock_instances, inst);
|
clock_instances = eina_list_remove(clock_instances, inst);
|
||||||
evas_object_del(inst->popup);
|
evas_object_del(inst->popup);
|
||||||
time_daynames_clear(inst);
|
time_daynames_clear(inst);
|
||||||
|
@ -359,19 +373,6 @@ _clock_gadget_configure(Evas_Object *g)
|
||||||
return config_clock(inst->cfg, e_comp_object_util_zone_get(g));
|
return config_clock(inst->cfg, e_comp_object_util_zone_get(g));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_clock_gadget_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|
||||||
{
|
|
||||||
Instance *inst = data;
|
|
||||||
|
|
||||||
if (inst->o_clock != event_info) return;
|
|
||||||
time_config->items = eina_list_remove(time_config->items, inst->cfg);
|
|
||||||
eina_stringshare_del(inst->cfg->timezone);
|
|
||||||
eina_stringshare_del(inst->cfg->time_str[0]);
|
|
||||||
eina_stringshare_del(inst->cfg->time_str[1]);
|
|
||||||
E_FREE(inst->cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clock_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
_clock_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue