[Attach-panel] Fixed memory leak and rotate issue when camera is working 70/101570/1 accepted/tizen/3.0/mobile/20161215.044329 accepted/tizen/3.0/mobile/20161215.050751 submit/tizen_3.0/20161213.043701 submit/tizen_3.0/20161214.085051 submit/tizen_3.0/20161215.013730
authormoon87.park <moon87.park@samsung.com>
Thu, 1 Dec 2016 12:24:45 +0000 (21:24 +0900)
committermoon87.park <moon87.park@samsung.com>
Thu, 1 Dec 2016 12:24:45 +0000 (21:24 +0900)
Change-Id: Iff822481879c953ac8b4c2edbf546fabbdd4c489

src/attach_panel.c
src/content_list.c
src/gesture.c
src/grid.c
src/scroller.c
src/toolbar.c
src/ug.c
src/ui_manager.c

index 93597a4bdc59e1e5b0237ea549397979e0e576c9..8037ee89428f07c1467d88b55e454a2a02c23b93 100644 (file)
@@ -195,7 +195,7 @@ static Evas_Object *__attach_panel_rect_add(Evas_Object *conformant, int height)
        evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, 1.0);
        evas_object_size_hint_min_set(rect, 0, height);
-       evas_object_color_set(rect, 0, 0, 0, 0);
+       evas_object_color_set(rect, 0, 0, 0, 255);
        evas_object_show(rect);
 
        return rect;
@@ -238,6 +238,7 @@ static void __rotate_cb(void *data, Evas_Object *obj, void *event)
                w = h;
                attach_panel->rotate = EINA_TRUE;
 
+               _D("port_state: %d land_state: %d", attach_panel->attach_panel_port_state, attach_panel->attach_panel_land_state);
                if (ATTACH_PANEL_STATE_HIDDEN == attach_panel->attach_panel_port_state) {
                        attach_panel->attach_panel_land_state = ATTACH_PANEL_STATE_HIDDEN;
                } else if (ATTACH_PANEL_STATE_PARTIAL == attach_panel->attach_panel_port_state) {
index 5f12c7474e33918a94fadb966c7e41d411b19d31..95622acb1e11b7ea526fa8f4f1d95e58d4d81bb8 100644 (file)
@@ -74,6 +74,7 @@ void _content_list_send_message(Eina_List *list, const char *key, const char *va
                                continue;
                        }
                        ug_send_message(ui_gadget, app_control);
+                       _D("%s: key[%s] val[%s]", innate_content_info->appid, key, value);
                }
        }
 
@@ -127,6 +128,7 @@ void _content_list_send_message_to_content(Eina_List *list, const char *key, con
                return;
        }
        ug_send_message(ui_gadget, app_control);
+       _D("%s: key[%s] val[%s]", content_info->innate_content_info->appid, key, value);
 
        ret = app_control_destroy(app_control);
        ret_if(APP_CONTROL_ERROR_NONE != ret);
index cc16da9bbf720670432261d95bb38954325ec0de..215afc7a22935df97776fc503343b76a2d48e2c3 100644 (file)
@@ -302,18 +302,15 @@ void _gesture_hide_ex(attach_panel_h attach_panel, bool use_transition, const ch
 {
        _content_list_set_pause(attach_panel->content_list, ATTACH_PANEL_CONTENT_CATEGORY_UG);
 
-       _D("gestrue hide start");
+       _D("gestrue hide start: %s(%d)", func, line);
        elm_config_focus_autoscroll_mode_set(attach_panel->autoscroll_mode);
 
-       if (attach_panel->rotate) {
+       if (attach_panel->rotate || ATTACH_PANEL_STATE_FULL == attach_panel->attach_panel_port_state) {
                attach_panel->attach_panel_land_state = ATTACH_PANEL_STATE_HIDDEN;
                elm_object_signal_emit(attach_panel->conformant, "elm,state,attach_panel,show,half", "");
-       } else {
-               if (ATTACH_PANEL_STATE_FULL == attach_panel->attach_panel_port_state) {
-                       elm_object_signal_emit(attach_panel->conformant, "elm,state,attach_panel,show,half", "");
-               }
-               attach_panel->attach_panel_port_state = ATTACH_PANEL_STATE_HIDDEN;
        }
+       attach_panel->attach_panel_land_state = ATTACH_PANEL_STATE_HIDDEN;
+       attach_panel->attach_panel_port_state = ATTACH_PANEL_STATE_HIDDEN;
        gesture_info_s.attach_panel_state = ATTACH_PANEL_STATE_HIDDEN;
        _content_list_set_flick(attach_panel->content_list, EINA_TRUE);
        if (use_transition) {
index 5bc08fe6e1d9f872cb5e1c940ff77527384e355e..92c5aa39f338701ed300c2e6488c5caf1f2c1baf 100644 (file)
@@ -223,7 +223,7 @@ static void __reply_cb(app_control_h request, app_control_h reply, app_control_r
 
                if (is_file_selected) {
                        /* This is same with attach_panel_hide() */
-                       _gesture_hide(content_info->attach_panel);
+                       _gesture_hide_ex(content_info->attach_panel, false, __func__, __LINE__);
                        _attach_panel_call_result_callback(attach_panel, content_info, reply, APP_CONTROL_RESULT_SUCCEEDED, true);
                } else {
                        _attach_panel_call_result_callback(attach_panel, content_info, reply, result, false);
@@ -321,10 +321,13 @@ static void __launch_app(content_s *content_info)
                _E("Fail to set launch mode");
 
        ret = app_control_send_launch_request(app_control, __reply_cb, content_info);
-       if (APP_CONTROL_ERROR_NONE != ret)
+       if (APP_CONTROL_ERROR_NONE != ret) {
                _E("Fail to send launch request");
+               app_control_destroy(app_control);
+       } else {
+               attach_panel->launched_app = app_control;
+       }
 
-       app_control_destroy(app_control);
 }
 
 
@@ -380,7 +383,10 @@ Eina_Bool __animator_cb(void *data)
 
        retv_if(!grid, ECORE_CALLBACK_CANCEL);
 
-       list = evas_object_data_get(grid, PRIVATE_DATA_KEY_GRID_LIST);
+       Eina_List **pList = evas_object_data_get(grid, PRIVATE_DATA_KEY_GRID_LIST);
+       retv_if(!pList, ECORE_CALLBACK_CANCEL);
+
+       list = *pList;
        retv_if(!list, ECORE_CALLBACK_CANCEL);
 
        gic = _item_class_new();
@@ -529,7 +535,7 @@ Evas_Object *_grid_create(Evas_Object *page, attach_panel_h attach_panel)
        elm_gengrid_multi_select_set(grid, EINA_FALSE);
        elm_object_style_set(grid, "popup");
 
-       evas_object_data_set(grid, PRIVATE_DATA_KEY_GRID_LIST, attach_panel->content_list);
+       evas_object_data_set(grid, PRIVATE_DATA_KEY_GRID_LIST, &attach_panel->content_list);
        evas_object_data_set(grid, PRIVATE_DATA_KEY_LIST_INDEX, NULL);
        evas_object_data_set(grid, DATA_KEY_EDGE_TOP, (void *)1);
        evas_object_smart_callback_add(grid, "edge,top", __edge_top_cb, NULL);
index b273af6821012c4844d71c8f9f8f97128d829aa4..93712c2013aaf1db52241044c670a0ace8437e68 100644 (file)
@@ -424,6 +424,7 @@ int _scroller_unregister_event_cb(Evas_Object *scroller, int event_type, void (*
                if (event_cb_info->event_type == event_type
                        && event_cb_info->event_cb == event_cb) {
                        event_cb_list = eina_list_remove(event_cb_list, event_cb_info);
+                       free(event_cb_info);
                        break;
                }
        }
index 1939070cc6c97f13a30742465e77eba8315908cc..958bd6caba7d440c77599cad701c23d2fb6a368c 100644 (file)
@@ -234,6 +234,7 @@ int _toolbar_unregister_event_cb(Evas_Object *toolbar, int event_type, void (*ev
                if (event_cb_info->event_type == event_type
                        && event_cb_info->event_cb == event_cb) {
                        event_cb_list = eina_list_remove(event_cb_list, event_cb_info);
+                       free(event_cb_info);
                        break;
                }
        }
index a951e5ec1a62825b0ce8263d46d9b90e99db8305..792b325616c6c5abc6a15dd6206c44ce87bd05e2 100644 (file)
--- a/src/ug.c
+++ b/src/ug.c
@@ -35,6 +35,7 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
        int ret = 0;
 
        ret_if(!content_info);
+       ret_if(_attach_panel_is_deleted(content_info->attach_panel));
 
        if (ATTACH_PANEL_STATE_HIDDEN == _gesture_get_state())
                return;
@@ -52,6 +53,7 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
                        _E("__ATTACH_PANEL_FLICK_DOWN__ value is wrong type(%s)", enable);
                        content_info->flick = EINA_TRUE;
                }
+               free(enable);
                return;
        }
 
@@ -65,6 +67,7 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
                } else {
                        _E("__ATTACH_PANEL_FULL_MODE__ value is wrong type(%s)", enable);
                }
+               free(enable);
                return;
        }
 
@@ -87,6 +90,7 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
                                _gesture_hide(content_info->attach_panel);
                        }
                }
+               free(enable);
                return;
        }
 
@@ -101,11 +105,11 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
                } else {
                        elm_object_signal_emit(content_info->attach_panel->ui_manager, "toolbar,hide", "toolbar");
                }
+               free(enable);
                return;
        }
 
        _D("The core of the panel sends the results to the caller");
-
        _D("relay callback is called");
 
        if (content_info->attach_panel->result_cb) {
@@ -123,7 +127,7 @@ static void __result_cb(ui_gadget_h ui_gadget, app_control_h result, void *priv)
 
                if (need_hide) {
                        /* This is same with attach_panel_hide() */
-                       _gesture_hide(content_info->attach_panel);
+                       _gesture_hide_ex(content_info->attach_panel, false, __func__, __LINE__);
                        _attach_panel_call_result_callback(attach_panel, content_info, result, APP_CONTROL_RESULT_SUCCEEDED, true);
                }
        } else {
@@ -142,7 +146,7 @@ static void __resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
        ret_if(!ui_manager);
 
        evas_object_geometry_get(ui_manager, &x, &y, &w, &h);
-       _D("%s resize(%d, %d, %d, %d)", data, x, y, w, h);
+       _D("resize(%d, %d, %d, %d)", x, y, w, h);
 
        attach_panel_h attach_panel = data;
        if (attach_panel) {
index a2de09d96626b7382582d7d6e09cbdfcf09ad1d2..8fe7309621a8cf72e99b11b7f3bde19dd91ac559 100644 (file)
@@ -206,6 +206,14 @@ int _ui_manager_append_content_category(Evas_Object *ui_manager, innate_content_
                        content_info->index = 0;
                }
                _D("added index %d", content_info->index);
+               if (_gesture_get_state() != ATTACH_PANEL_STATE_HIDDEN) {
+                       int page_no = NULL;
+                       elm_scroller_current_page_get(attach_panel->scroller, &page_no, NULL);
+                       if (page_no == content_info->index) {
+                               _D("more tab was visible and new page inserted before it");
+                               _scroller_show_page(attach_panel->scroller, attach_panel->grid_page, attach_panel);
+                       }
+               }
        } else {
                attach_panel->content_list = eina_list_append(attach_panel->content_list, content_info);
                content_info->index = eina_list_count(attach_panel->content_list) - 1;