evas: Fix crash in Efl.Ui.Box

This goes back to a stupid comment I made in 93fad2a19f2507a:
  No idea why evas_box was overwriting smart_data.get
  (esp. since it was returning a private struct).
Well, it turns out the struct is NOT private and the smart
data pointer can be used by any user of evas box (including
Efl.Ui.Box).

Fixes T3926
This commit is contained in:
Jean-Philippe Andre 2016-06-22 10:53:37 +09:00
parent b09c1f8093
commit f067bc6f71
1 changed files with 11 additions and 3 deletions

View File

@ -378,12 +378,14 @@ _evas_box_internal_remove_at(Eo *o, Evas_Object_Box_Data *priv, unsigned int pos
}
EOLIAN static void
_evas_box_efl_canvas_group_group_add(Eo *o, Evas_Object_Box_Data *priv)
_evas_box_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Box_Data *priv)
{
efl_canvas_group_add(eo_super(o, MY_CLASS));
Evas_Object_Smart_Clipped_Data *cso;
efl_canvas_group_add(eo_super(eo_obj, MY_CLASS));
evas_object_event_callback_add
(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_hints_changed, o);
(eo_obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_hints_changed, eo_obj);
priv->children = NULL;
priv->align.h = 0.5;
priv->align.v = 0.5;
@ -392,6 +394,12 @@ _evas_box_efl_canvas_group_group_add(Eo *o, Evas_Object_Box_Data *priv)
priv->layout.cb = evas_object_box_layout_horizontal;
priv->layout.data = NULL;
priv->layout.free_data = NULL;
// make sure evas box smart data is fully initialized and set (for legacy)
// this assumes only box and smart clipped access the smart data
cso = eo_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
priv->base = *cso;
evas_object_smart_data_set(eo_obj, priv);
}
EOLIAN static void