summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-24 23:45:14 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-24 23:51:38 +0900
commitbe6f4a870a667974280332ba6693e1223ec51dc5 (patch)
tree4f4540646299efc7d5823642e00f8e107b22f4fa
parent40214e16c72fb26e7dbdde0344dc771acc2aaa6b (diff)
efl ui slider - fix crashes with fmt callback data and class data
the format free cb was passed the class data (sd) as the callback data but this was freed by the time _indi_default_format_free_cb was called causing an invalid access. fix this by looking it up from the obj which is probably invalid at this point...
-rw-r--r--src/lib/elementary/efl_ui_slider.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c
index 1bc9ec9..b5da71e 100644
--- a/src/lib/elementary/efl_ui_slider.c
+++ b/src/lib/elementary/efl_ui_slider.c
@@ -1421,7 +1421,7 @@ static void
1421_indi_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value) 1421_indi_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
1422{ 1422{
1423 const Eina_Value_Type *type = eina_value_type_get(&value); 1423 const Eina_Value_Type *type = eina_value_type_get(&value);
1424 Efl_Ui_Slider_Data *sd = data; 1424 Efl_Ui_Slider_Data *sd = efl_data_scope_get(data, EFL_UI_SLIDER_CLASS);
1425 double v; 1425 double v;
1426 1426
1427 if (type != EINA_VALUE_TYPE_DOUBLE) return; 1427 if (type != EINA_VALUE_TYPE_DOUBLE) return;
@@ -1433,7 +1433,7 @@ _indi_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
1433static void 1433static void
1434_indi_default_format_free_cb(void *data) 1434_indi_default_format_free_cb(void *data)
1435{ 1435{
1436 Efl_Ui_Slider_Data *sd = data; 1436 Efl_Ui_Slider_Data *sd = efl_data_scope_get(data, EFL_UI_SLIDER_CLASS);
1437 1437
1438 if (sd && sd->indi_template) 1438 if (sd && sd->indi_template)
1439 { 1439 {
@@ -1451,7 +1451,7 @@ _efl_ui_slider_part_efl_ui_format_format_string_set(Eo *obj, void *_pd EINA_UNUS
1451 if (!template) return; 1451 if (!template) return;
1452 eina_stringshare_replace(&sd->indi_template, template); 1452 eina_stringshare_replace(&sd->indi_template, template);
1453 1453
1454 efl_ui_format_cb_set(efl_part(pd->obj, "indicator"), sd, _indi_default_format_cb, _indi_default_format_free_cb); 1454 efl_ui_format_cb_set(efl_part(pd->obj, "indicator"), pd->obj, _indi_default_format_cb, _indi_default_format_free_cb);
1455} 1455}
1456 1456
1457EOLIAN static const char * 1457EOLIAN static const char *