edje: fixing the check whether the part is swallow.
authorVorobiov Vitalii <vi.vorobiov@samsung.com>
Tue, 12 Nov 2013 02:18:22 +0000 (11:18 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Tue, 12 Nov 2013 02:18:22 +0000 (11:18 +0900)
Summary:
Some functions doesn't checking the part right.
For example:
edje_edit_part_clip_to_set
edje_edit_part_restack_below
edje_edit_part_restack_above
edje_edit_part_source_set

Reviewers: cedric, seoz

Reviewed By: cedric

CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D325

src/lib/edje/edje_edit.c

index c7997cd..c0584f2 100644 (file)
@@ -2212,7 +2212,7 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part)
    _edje_parts_id_switch(ed, rp, prev);
 
    evas_object_stack_below(rp->object, prev->object);
-   if (rp->typedata.swallow->swallowed_object)
+   if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
      evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
 
    _edje_edit_flag_script_dirty(eed, EINA_TRUE);
@@ -2247,7 +2247,7 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part)
    _edje_parts_id_switch(ed, rp, next);
 
    evas_object_stack_above(rp->object, next->object);
-   if (rp->typedata.swallow->swallowed_object)
+   if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
      evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
 
    _edje_edit_flag_script_dirty(eed, EINA_TRUE);
@@ -2322,8 +2322,6 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
    /* unset clipping */
    if (!clip_to)
      {
-       //printf("UnSet clip_to for part: %s\n", part);
-
        if (rp->part->clip_to_id >= 0)
          {
             clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
@@ -2334,8 +2332,8 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
          }
 
        evas_object_clip_set(rp->object, ed->base->clipper);
-       if (rp->typedata.swallow->swallowed_object)
-         evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper);
+        if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
+          evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper);
 
        rp->part->clip_to_id = -1;
 
@@ -2361,7 +2359,7 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_
    evas_object_pass_events_set(clip->object, 1);
    evas_object_pointer_mode_set(clip->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
    evas_object_clip_set(rp->object, clip->object);
-   if (rp->typedata.swallow->swallowed_object)
+   if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
      evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip->object);
 
    edje_object_calc_force(obj);
@@ -2483,7 +2481,7 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source
 
    _edje_if_string_free(ed, rp->part->source);
 
-   if (rp->typedata.swallow->swallowed_object)
+   if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
      {
        _edje_real_part_swallow_clear(ed, rp);
        evas_object_del(rp->typedata.swallow->swallowed_object);