cnp: check object type before getting window id
authorwonguk.jeong <wonguk.jeong@samsung.com>
Tue, 1 Apr 2014 10:54:09 +0000 (19:54 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Tue, 1 Apr 2014 10:54:09 +0000 (19:54 +0900)
Summary:
problem:
1) elementary_test -> entry -> close entry window
2) type mismatch warning is shown on console as below

ERR<19427>:eo lib/eo/eo.c:342 _eo_dov_internal() in elm_win.eo.c:2067: Can't execute function Elm_Win:ELM_OBJ_WIN_SUB_ID_XWINDOW_GET (op 0x167) for class 'Elm_Entry'. Aborting.

solution:
check top object type before invoke elm_win_xwindow_get()/elm_wl_window_get().
if it's not a window, find window id by using ecore_evas APIs.

Fixes T1141

Test Plan: elementary_test -> entry -> close entry window -> check console

Reviewers: raster, seoz, uartie

Reviewed By: raster

CC: seoz
Maniphest Tasks: T1141

Differential Revision: https://phab.enlightenment.org/D684

src/lib/elm_cnp.c

index 35af060..df107a4 100644 (file)
@@ -1826,7 +1826,8 @@ _x11_elm_widget_xwin_get(const Evas_Object *obj)
              par = elm_widget_parent_widget_get(obj);
              if (par) top = elm_widget_top_get(par);
           }
-        if (top) xwin = elm_win_xwindow_get(top);
+        if (top && (eo_isa(top, ELM_OBJ_WIN_CLASS)))
+            xwin = elm_win_xwindow_get(top);
      }
    if (!xwin)
      {
@@ -3423,7 +3424,8 @@ _wl_elm_widget_window_get(Evas_Object *obj)
      {
         top = elm_widget_top_get(obj);
         if (!top) top = elm_widget_top_get(elm_widget_parent_widget_get(obj));
-        if (top) win = elm_win_wl_window_get(top);
+        if (top && (eo_isa(top, ELM_OBJ_WIN_CLASS)))
+            win = elm_win_wl_window_get(top);
      }
    if (!win)
      {