Revert "edje_entry: fix a potentional error of null deref" 07/245307/1
authorWonki Kim <wonki_.kim@samsung.com>
Wed, 7 Oct 2020 03:11:28 +0000 (12:11 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 7 Oct 2020 03:26:13 +0000 (12:26 +0900)
This reverts commit 807b0e3135ed5465013911ca8a6904b9d23e2eff.

Change-Id: Ib444d664e8420a29c888f4bafa447e2bb42d7e65

src/lib/edje/edje_entry.c

index c44f0e5..f0614bd 100644 (file)
@@ -1297,124 +1297,101 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en,
                        free(sel);
                        an->sel = eina_list_remove_list(an->sel, an->sel);
                     }
-                  if (range)
+                  Evas_Textblock_Rectangle *r, *r_last;
+
+                  r = range->data;
+                  r_last = eina_list_last_data_get(range);
+                  if (r->y != r_last->y)
+                    {
+                       /* For multiple range */
+                       r->h = r->y + r_last->y + r_last->h;
+                    }
+                  /* For vertically layout entry */
+                  /******************************************************************************************
+                   * TIZEN_ONLY(20161207): force update anchors when a API is called to get list of anchors *
+                   ******************************************************************************************
+                  if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
+                   */
+                  if (!force_update && _is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
+                  /*******
+                   * END *
+                   *******/
+                    {
+                       EINA_LIST_FREE(range, r)
+                         free(r);
+                       continue;
+                    }
+                  else
                     {
-                       Evas_Textblock_Rectangle *r, *r_last;
+                       /* XXX: Should consider for horizontal entry but has
+                        * very minimal usage. Probably we should get the min x
+                        * and max w for range and then decide whether it is in
+                        * the viewport or not. Unnecessary calculation for this
+                        * minimal usage. Please test with large number of anchors
+                        * after implementing it, if its needed to be.
+                        */
+                    }
+                  for (ll = range; ll; ll = eina_list_next(ll))
+                    {
+                       Evas_Object *ob;
 
-                       r = range->data;
-                       r_last = eina_list_last_data_get(range);
-                       if (r->y != r_last->y)
+                       sel = calloc(1, sizeof(Sel));
+                       if (!sel)
                          {
-                            /* For multiple range */
-                            r->h = r->y + r_last->y + r_last->h;
+                            ERR("Running very low on memory");
+                            break;
                          }
-                       /* For vertically layout entry */
-                       /******************************************************************************************
-                        * TIZEN_ONLY(20161207): force update anchors when a API is called to get list of anchors *
-                        ******************************************************************************************
-                       if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
-                        */
-                       if (!force_update && _is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
-                       /*******
-                        * END *
-                        *******/
+                       an->sel = eina_list_append(an->sel, sel);
+                       if (en->rp->part->source5)
                          {
-                            EINA_LIST_FREE(range, r)
-                              free(r);
-                            continue;
+                            ob = edje_object_add(ed->base.evas);
+                            edje_object_file_set(ob, ed->path, en->rp->part->source5);
+                            evas_object_smart_member_add(ob, smart);
+                            evas_object_stack_below(ob, o);
+                            evas_object_clip_set(ob, clip);
+                            evas_object_pass_events_set(ob, EINA_TRUE);
+                            sel->obj_bg = ob;
+                            _edje_subobj_register(ed, sel->obj_bg);
+                            /***********************************************************************************
+                             * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+                             ***********************************************************************************/
+                            edje_object_color_class_parent_set(sel->obj_bg, ed->obj);
+                            /*******
+                             * END *
+                             *******/
                          }
-                       else
-                         {
-                            Evas_Textblock_Rectangle *r, *r_last;
 
-                            r = range->data;
-                            r_last = eina_list_last_data_get(range);
-                            if (r->y != r_last->y)
-                              {
-                                 /* For multiple range */
-                                 r->h = r->y + r_last->y + r_last->h;
-                              }
-                            /* For vertically layout entry */
-                            if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
-                              {
-                                 ob = edje_object_add(ed->base.evas);
-                                 edje_object_file_set(ob, ed->path, en->rp->part->source5);
-                                 evas_object_smart_member_add(ob, smart);
-                                 evas_object_stack_below(ob, o);
-                                 evas_object_clip_set(ob, clip);
-                                 evas_object_pass_events_set(ob, EINA_TRUE);
-                                 sel->obj_bg = ob;
-                                 _edje_subobj_register(ed, sel->obj_bg);
-                                 /***********************************************************************************
-                                  * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
-                                  ***********************************************************************************/
-                                 edje_object_color_class_parent_set(sel->obj_bg, ed->obj);
-                                 /*******
-                                  * END *
-                                  *******/
-                              }
-                            else
-                              {
-                                 /* XXX: Should consider for horizontal entry but has
-                                  * very minimal usage. Probably we should get the min x
-                                  * and max w for range and then decide whether it is in
-                                  * the viewport or not. Unnecessary calculation for this
-                                  * minimal usage. Please test with large number of anchors
-                                  * after implementing it, if its needed to be.
-                                  */
-                              }
-                            for (ll = range; ll; ll = eina_list_next(ll))
-                              {
-                                 Evas_Object *ob;
-
-                                 sel = calloc(1, sizeof(Sel));
-                                 if (!sel)
-                                   {
-                                      ERR("Running very low on memory");
-                                      break;
-                                   }
-                                 an->sel = eina_list_append(an->sel, sel);
-                                 if (en->rp->part->source5)
-                                   {
-                                      ob = edje_object_add(ed->base.evas);
-                                      edje_object_file_set(ob, ed->path, en->rp->part->source5);
-                                      evas_object_smart_member_add(ob, smart);
-                                      evas_object_stack_below(ob, o);
-                                      evas_object_clip_set(ob, clip);
-                                      evas_object_pass_events_set(ob, EINA_TRUE);
-                                      sel->obj_bg = ob;
-                                      _edje_subobj_register(ed, sel->obj_bg);
-                                   }
-
-                                 if (en->rp->part->source6)
-                                   {
-                                      ob = edje_object_add(ed->base.evas);
-                                      edje_object_file_set(ob, ed->path, en->rp->part->source6);
-                                      evas_object_smart_member_add(ob, smart);
-                                      evas_object_stack_above(ob, o);
-                                      evas_object_clip_set(ob, clip);
-                                      evas_object_pass_events_set(ob, EINA_TRUE);
-                                      sel->obj_fg = ob;
-                                      _edje_subobj_register(ed, sel->obj_fg);
-                                   }
-
-                                 ob = evas_object_rectangle_add(ed->base.evas);
-                                 evas_object_color_set(ob, 0, 0, 0, 0);
-                                 evas_object_smart_member_add(ob, smart);
-                                 evas_object_stack_above(ob, o);
-                                 evas_object_clip_set(ob, clip);
-                                 evas_object_pass_events_set(ob, EINA_TRUE);
-                                 sel->obj_fg = ob;
-                                 _edje_subobj_register(ed, sel->obj_fg);
-                                 /***********************************************************************************
-                                  * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
-                                  ***********************************************************************************/
-                                 edje_object_color_class_parent_set(sel->obj_fg, ed->obj);
-                                 /*******
-                                  * END *
-                                  *******/
-                              }
+                       if (en->rp->part->source6)
+                         {
+                            ob = edje_object_add(ed->base.evas);
+                            edje_object_file_set(ob, ed->path, en->rp->part->source6);
+                            evas_object_smart_member_add(ob, smart);
+                            evas_object_stack_above(ob, o);
+                            evas_object_clip_set(ob, clip);
+                            evas_object_pass_events_set(ob, EINA_TRUE);
+                            sel->obj_fg = ob;
+                            _edje_subobj_register(ed, sel->obj_fg);
+                            /***********************************************************************************
+                             * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+                             ***********************************************************************************/
+                            edje_object_color_class_parent_set(sel->obj_fg, ed->obj);
+                            /*******
+                             * END *
+                             *******/
                          }
+
+                       ob = evas_object_rectangle_add(ed->base.evas);
+                       evas_object_color_set(ob, 0, 0, 0, 0);
+                       evas_object_smart_member_add(ob, smart);
+                       evas_object_stack_above(ob, o);
+                       evas_object_clip_set(ob, clip);
+                       evas_object_repeat_events_set(ob, EINA_TRUE);
+                       evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
+                       evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
+                       evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
+                       evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
+                       evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
+                       sel->obj = ob;
                     }
                }