elm_widget: Fix order of operations (isa before data_get)
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 15 Feb 2017 04:32:15 +0000 (13:32 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 15 Feb 2017 04:38:19 +0000 (13:38 +0900)
This fixes some of the occurences of the following error message
when using eo_debug:

ERR<23101>:eo /home/jpeg/e/core/efl/src/lib/eo/eo.c:1955
  efl_data_scope_get() Tried getting data of class 'Elm.Widget'
  from object of class 'Edje.Object', but the former is not a
  direct inheritance of the latter.

If we're going to call efl_isa, then let's at least do it before
efl_data_scope_get.

src/lib/elementary/elm_widget.c

index a391c98..dd459bb 100644 (file)
   Elm_Widget_Smart_Data *wd = efl_data_scope_get(o, MY_CLASS)
 
 #define API_ENTRY                                    \
-  ELM_WIDGET_DATA_GET(obj, sd);                      \
-  if ((!sd) || (!_elm_widget_is(obj)))
+  Elm_Widget_Smart_Data *sd = NULL;                  \
+  if (!_elm_widget_is(obj) ||                        \
+      (!(sd = efl_data_scope_get(obj, MY_CLASS))))
+
 #define INTERNAL_ENTRY                               \
   ELM_WIDGET_DATA_GET(obj, sd);                      \
   if (!sd) return
@@ -3141,15 +3143,16 @@ _elm_widget_disabled_eval(const Evas_Object *obj, Eina_Bool disabled)
    else
      {
         EINA_LIST_FOREACH(sd->subobjs, l, child)
-          {
-             ELM_WIDGET_DATA_GET(child, sdc);
-             if (elm_widget_is(child) && !sdc->disabled)
-               {
-                  elm_widget_focus_disabled_handle(child);
-                  elm_obj_widget_disable(child);
-                  _elm_widget_disabled_eval(child, EINA_FALSE);
-               }
-          }
+          if (elm_widget_is(child))
+            {
+               ELM_WIDGET_DATA_GET(child, sdc);
+               if (!sdc->disabled)
+                 {
+                    elm_widget_focus_disabled_handle(child);
+                    elm_obj_widget_disable(child);
+                    _elm_widget_disabled_eval(child, EINA_FALSE);
+                 }
+            }
      }
 }