aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/edje
diff options
context:
space:
mode:
authorYeongjong Lee <cleanlyj@naver.com>2018-08-16 13:01:26 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-16 13:01:39 -0400
commit8bb11a172bfaac94b317f90004879356672e1571 (patch)
treee34b83327a81eaa63ed4ab9539ee43a2fa4fcfdc /src/lib/edje
parentecore_evas: Fix elm warnings when building without wayland support (diff)
downloadefl-8bb11a172bfaac94b317f90004879356672e1571.tar.gz
evas: check evas class instead of using evas_find
Summary: A object that is not evas class shouldn't use evas_find. it may occurs segfault. ref c2e8b492b18bdecc2300ad051ba1406e40ad068f Test Plan: Evas *evas = evas_new(); evas_free(evas); evas_object_line_add(evas); Check weather there is segfault. Reviewers: Hermet, raster, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6816
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_edit.c3
-rw-r--r--src/lib/edje/edje_smart.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 2527598c69..e2bbc8498f 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -13,6 +13,8 @@
#include "edje_private.h"
+#include "canvas/evas_canvas.eo.h"
+
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
#include "Edje_Edit.h"
@@ -289,6 +291,7 @@ _edje_edit_efl_file_mmap_set(Eo *obj, Edje_Edit *eed, const Eina_File *mmap, con
EAPI Evas_Object *
edje_edit_object_add(Evas *evas)
{
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(evas, EVAS_CANVAS_CLASS), NULL);
return efl_add(MY_CLASS, evas_find(evas), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 29d042c40d..9e405ceb56 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -4,6 +4,8 @@
#include "edje_private.h"
+#include "canvas/evas_canvas.eo.h"
+
#ifdef MY_CLASS
# undef MY_CLASS
#endif
@@ -20,7 +22,7 @@ Eina_Inlist *_edje_edjes = NULL;
EAPI Evas_Object *
edje_object_add(Evas *evas)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(evas, NULL);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(evas, EVAS_CANVAS_CLASS), NULL);
return efl_add(MY_CLASS, evas_find(evas), efl_canvas_object_legacy_ctor(efl_added));
}