From faa0dbbdf64a1dc41b3096045e37caefe2e96e50 Mon Sep 17 00:00:00 2001 From: Hyojung Jo Date: Wed, 18 Mar 2015 14:52:09 +0900 Subject: [PATCH] Fixed the Destroy of appbaseview.cpp. Change-Id: I13b9e34174aea6f4e780fce0aac18e8efcd66469 Signed-off-by: Hyojung Jo --- src/view/AppsBaseView.cpp | 103 +++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 65 deletions(-) diff --git a/src/view/AppsBaseView.cpp b/src/view/AppsBaseView.cpp index 9fb237b..e02f0a2 100644 --- a/src/view/AppsBaseView.cpp +++ b/src/view/AppsBaseView.cpp @@ -344,70 +344,34 @@ bool CAppsBaseView::Create(void *data) { ASSERT(!m); - Evas_Object *win; - CLayoutMgr *lmgr; - - m = new SAppsBaseView; - if (!m) { - _ERR("memory alloc failed."); - return false; - } - - win = CViewMgr::GetInstance()->Window(); - if (!win) { - _ERR("Get window failed."); - delete m; - m = NULL; - return false; - } - - m->base = elm_layout_add(win); - if (!m->base) { - _ERR("elm_layout_add failed."); - delete m; - m = NULL; - return false; - } - - elm_layout_file_set(m->base, EDJEFILE, GRP_BRPAGE); - - lmgr = new CLayoutMgr; - if (!lmgr) { - evas_object_del(m->base); - delete m; - m = NULL; - return false; - } - - if (!lmgr->Create(m->base, NULL)) { - _ERR("Initialize the lmgr failed."); - evas_object_del(m->base); - delete m; - m = NULL; - return false; - } - - m->win = win; - m->lmgr = lmgr; - - m->pAppsBaseLayout = new CAppsBaseLayout(APPS_BASE_LAYOUT); - m->pAppsBaseLayout->Create(m->lmgr, NULL); - m->lmgr->AddLayout(m->pAppsBaseLayout); - - _SET_PRIV(m->base, m); - - if (!m_DrawFullView()) { - _ERR("Draw view failed."); - evas_object_del(m->base); - delete m; - m = NULL; - return false; - } - - if (!m->lmgr->Show(APPS_BASE_LAYOUT)) - _ERR("Failed to load base layout."); - - CBaseView::Create(NULL); + _CREATE_BEGIN { + _CHECK(m = new SAppsBaseView) + _CHECK(m->win = CViewMgr::GetInstance()->Window()) + _CHECK(m->base = elm_layout_add(m->win)) + _CHECK(elm_layout_file_set(m->base, EDJEFILE, GRP_BRPAGE)) + _CHECK(m->lmgr = new CLayoutMgr) + _CHECK(m->lmgr->Create(m->base, NULL)) + _CHECK(m->pAppsBaseLayout = new CAppsBaseLayout(APPS_BASE_LAYOUT)) + _CHECK(m->pAppsBaseLayout->Create(m->lmgr, NULL)) + _CHECK(m->lmgr->AddLayout(m->pAppsBaseLayout)) + _COMMAND { _SET_PRIV(m->base, m); } + _CHECK(m_DrawFullView()) + _CHECK(m->lmgr->Show(APPS_BASE_LAYOUT)) + _CHECK(CBaseView::Create(NULL)) + + _CHECK_FAIL { CBaseView::Destroy(); } + _CHECK_FAIL { /* m->lmgr->Show */ } + _CHECK_FAIL { /* m_DrawFullView */ } + _CHECK_FAIL { m->lmgr->RemoveLayout(m->pAppsBaseLayout); } + _CHECK_FAIL { m->pAppsBaseLayout->Destroy(); } + _CHECK_FAIL { delete m->pAppsBaseLayout; m->pAppsBaseLayout = NULL; } + _CHECK_FAIL { m->lmgr->Destroy(); } + _CHECK_FAIL { delete m->lmgr; m->lmgr = NULL; } + _CHECK_FAIL { /* elm_layout_file_set */ } + _CHECK_FAIL { evas_object_del(m->base); } + _CHECK_FAIL { /* CViewMgr::GetInstance()->Window */ } + _CHECK_FAIL { delete m; m = NULL; } + } _CREATE_END_AND_CATCH { return false; } return true; } @@ -418,8 +382,17 @@ void CAppsBaseView::Destroy(void) ASSERT(m); CBaseView::Destroy(); - evas_object_del(m->base); + m->lmgr->RemoveLayout(m->pAppsBaseLayout); + m->pAppsBaseLayout->Destroy(); + delete m->pAppsBaseLayout; + m->pAppsBaseLayout = NULL; + + m->lmgr->Destroy(); + delete m->lmgr; + m->lmgr = NULL; + + evas_object_del(m->base); delete m; m = NULL; } -- 2.7.4