aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/lib/edje/edje_edit.c3
-rw-r--r--src/lib/edje/edje_smart.c4
-rw-r--r--src/lib/emotion/emotion_smart.c3
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c4
-rw-r--r--src/lib/evas/canvas/evas_object_box.c4
-rw-r--r--src/lib/evas/canvas/evas_object_grid.c4
-rw-r--r--src/lib/evas/canvas/evas_object_line.c4
-rw-r--r--src/lib/evas/canvas/evas_object_polygon.c4
-rw-r--r--src/lib/evas/canvas/evas_object_rectangle.c4
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c4
-rw-r--r--src/lib/evas/canvas/evas_object_table.c4
-rw-r--r--src/lib/evas/canvas/evas_object_text.c4
-rw-r--r--src/lib/evas/canvas/evas_object_textgrid.c4
13 files changed, 19 insertions, 31 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));
}
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index d68b84bce4..5f8f46e186 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -19,6 +19,8 @@
#include "Emotion.h"
#include "emotion_private.h"
+#include "canvas/evas_canvas.eo.h"
+
#ifdef _WIN32
# define FMT_UCHAR "%c"
#else
@@ -230,6 +232,7 @@ _clipper_position_size_update(Evas_Object *obj, int x, int y, int w, int h, int
EAPI Evas_Object *
emotion_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/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index cfd1898326..f9decd0a21 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -124,9 +124,7 @@ _evas_vg_resize(void *data, const Efl_Event *ev)
EAPI Evas_Object *
evas_object_vg_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
// TODO: Ask backend to return the main Ector_Surface
return efl_add(MY_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c
index 53e945118d..391f849468 100644
--- a/src/lib/evas/canvas/evas_object_box.c
+++ b/src/lib/evas/canvas/evas_object_box.c
@@ -475,9 +475,7 @@ _evas_box_efl_canvas_group_group_calculate(Eo *o, Evas_Object_Box_Data *priv)
EAPI Evas_Object *
evas_object_box_add(Evas *evas)
{
- MAGIC_CHECK(evas, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ 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/evas/canvas/evas_object_grid.c b/src/lib/evas/canvas/evas_object_grid.c
index b954bf2dce..2ff261961c 100644
--- a/src/lib/evas/canvas/evas_object_grid.c
+++ b/src/lib/evas/canvas/evas_object_grid.c
@@ -273,9 +273,7 @@ _evas_object_grid_smart_set_user(Evas_Smart_Class *sc)
EAPI Evas_Object *
evas_object_grid_add(Evas *evas)
{
- MAGIC_CHECK(evas, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ 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/evas/canvas/evas_object_line.c b/src/lib/evas/canvas/evas_object_line.c
index e26ea6677b..f506f758cb 100644
--- a/src/lib/evas/canvas/evas_object_line.c
+++ b/src/lib/evas/canvas/evas_object_line.c
@@ -94,9 +94,7 @@ static const Evas_Object_Func object_func =
EAPI Evas_Object *
evas_object_line_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
return efl_add(EVAS_LINE_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/evas/canvas/evas_object_polygon.c b/src/lib/evas/canvas/evas_object_polygon.c
index 90c05dda42..8f65277be7 100644
--- a/src/lib/evas/canvas/evas_object_polygon.c
+++ b/src/lib/evas/canvas/evas_object_polygon.c
@@ -84,9 +84,7 @@ static const Evas_Object_Func object_func =
EAPI Evas_Object *
evas_object_polygon_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
return efl_add(MY_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/evas/canvas/evas_object_rectangle.c b/src/lib/evas/canvas/evas_object_rectangle.c
index c5d8253aee..5a8baddd3b 100644
--- a/src/lib/evas/canvas/evas_object_rectangle.c
+++ b/src/lib/evas/canvas/evas_object_rectangle.c
@@ -92,9 +92,7 @@ static const Evas_Object_Func object_func =
EAPI Evas_Object *
evas_object_rectangle_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
return efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index 6223792cae..7feea17d38 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -675,9 +675,7 @@ evas_object_smart_add(Evas *eo_e, Evas_Smart *s)
{
Evas_Object *eo_obj;
- MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
eo_obj = efl_add(EFL_CANVAS_GROUP_CLASS, evas_find(eo_e), efl_canvas_object_legacy_ctor(efl_added));
evas_object_smart_attach(eo_obj, s);
return eo_obj;
diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c
index 97ba008266..3b8837f6cc 100644
--- a/src/lib/evas/canvas/evas_object_table.c
+++ b/src/lib/evas/canvas/evas_object_table.c
@@ -979,9 +979,7 @@ _evas_table_efl_canvas_group_group_calculate(Eo *o, Evas_Table_Data *priv)
EAPI Evas_Object *
evas_object_table_add(Evas *evas)
{
- MAGIC_CHECK(evas, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ 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/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 315b7ce015..5aae419759 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -376,9 +376,7 @@ _evas_object_text_vert_advance_get(const Evas_Object *obj EINA_UNUSED,
EAPI Evas_Object *
evas_object_text_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
return efl_add(EVAS_TEXT_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}
diff --git a/src/lib/evas/canvas/evas_object_textgrid.c b/src/lib/evas/canvas/evas_object_textgrid.c
index d817d94e46..8c5cd63fa1 100644
--- a/src/lib/evas/canvas/evas_object_textgrid.c
+++ b/src/lib/evas/canvas/evas_object_textgrid.c
@@ -899,9 +899,7 @@ _evas_textgrid_efl_gfx_entity_scale_set(Evas_Object *eo_obj, Evas_Textgrid_Data
EAPI Evas_Object *
evas_object_textgrid_add(Evas *e)
{
- MAGIC_CHECK(e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(e, EVAS_CANVAS_CLASS), NULL);
return efl_add(EVAS_TEXTGRID_CLASS, evas_find(e), efl_canvas_object_legacy_ctor(efl_added));
}