let ecore_evas_ecore_evas_get() be safer.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 27 May 2011 18:53:27 +0000 (18:53 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Fri, 27 May 2011 18:53:27 +0000 (18:53 +0000)
SVN revision: 59759

legacy/ecore/src/lib/ecore_evas/ecore_evas.c

index 9779f65..1bb844f 100644 (file)
@@ -832,12 +832,19 @@ ecore_evas_engine_name_get(const Ecore_Evas *ee)
  * Return the Ecore_Evas for this Evas
  *
  * @param e The Evas to get the Ecore_Evas from
- * @return The Ecore_Evas that holds this Evas
+ * @return The Ecore_Evas that holds this Evas, or NULL if not hold by one.
  */
 EAPI Ecore_Evas *
 ecore_evas_ecore_evas_get(const Evas *e)
 {
-   return evas_data_attach_get(e);
+   Ecore_Evas *ee = evas_data_attach_get(e);
+   if (!ee) return NULL;
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get");
+        return NULL;
+     }
+   return ee;
 }
 
 /**