evas: properly warn when linking object from different canvas.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 7 Aug 2012 09:43:22 +0000 (09:43 +0000)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 14 Aug 2012 12:59:22 +0000 (21:59 +0900)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@74968 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_clip.c
src/lib/canvas/evas_object_image.c

index 6baa28c..1597bfc 100644 (file)
@@ -176,14 +176,44 @@ evas_object_clip_set(Evas_Object *obj, Evas_Object *clip)
    return;
    MAGIC_CHECK_END();
    if (obj->cur.clipper == clip) return;
-   if (obj == clip) return;
+   if (obj == clip)
+     {
+        CRIT("Setting clip %p on itself", obj)
+        return;
+     }
+   if (clip->delete_me)
+     {
+        CRIT("Setting deleted object %p as clip obj %p", clip, obj);
+        abort();
+        return;
+     }
+   if (obj->delete_me)
+     {
+        CRIT("Setting object %p as clip to deleted obj %p", clip, obj);
+        abort();
+        return;
+     }
+   if (!obj->layer)
+     {
+        CRIT("No evas surface associated with object (%p)", obj);
+        abort();
+        return;
+     }
+   if ((obj->layer && clip->layer) &&
+       (obj->layer->evas != clip->layer->evas))
+     {
+        CRIT("Setting object %p from Evas (%p) to another Evas (%p)", obj, obj->layer->evas, clip->layer->evas);
+        abort();
+        return;
+     }
+
    if (evas_object_intercept_call_clip_set(obj, clip)) return;
    // illegal to set anything but a rect as a clip
-   /* if (clip->type != o_rect_type) */
-   /*   { */
-   /*      ERR("For now a clip on other object than a rectangle is disabled"); */
-   /*      return; */
-   /*   } */
+   if (clip->type != o_rect_type)
+     {
+        ERR("For now a clip on other object than a rectangle is disabled");
+        return;
+     }
    if (obj->smart.smart)
      {
        if (obj->smart.smart->smart_class->clip_set)
index 84b1c4c..c55e1e8 100755 (executable)
@@ -447,7 +447,37 @@ evas_object_image_source_set(Evas_Object *obj, Evas_Object *src)
    return EINA_FALSE;
    MAGIC_CHECK_END();
 
-   if (src == obj) return EINA_FALSE;
+   if (obj->delete_me)
+     {
+        CRIT("Setting deleted object %p as image source %p", src, obj);
+        abort();
+        return EINA_FALSE;
+     }
+   if (src->delete_me)
+     {
+        CRIT("Setting object %p to deleted image source %p", src, obj);
+        abort();
+        return EINA_FALSE;
+     }
+   if (!src->layer)
+     {
+        CRIT("No evas surface associated with source object (%p)", obj);
+        abort();
+        return EINA_FALSE;
+     }
+   if ((obj->layer && src->layer) &&
+       (obj->layer->evas != src->layer->evas))
+     {
+        CRIT("Setting object %p from Evas (%p) from another Evas (%p)", src, src->layer->evas, obj->layer->evas);
+        abort();
+        return EINA_FALSE;
+     }
+   if (src == obj)
+     {
+        CRIT("Setting object %p as a source for itself", obj);
+        abort();
+        return EINA_FALSE;
+     }
    if (o->cur.source == src) return EINA_TRUE;
 
    _evas_object_image_cleanup(obj, o);