From a16885391ccc501eefd12e1fa5c4bbee2d5a01cd Mon Sep 17 00:00:00 2001 From: rahul sharma Date: Tue, 2 Jul 2013 13:40:35 +0900 Subject: [PATCH] Fixed Nabi issue and major memory leaks by valgrind Change-Id: I330ec103efb082487f7a8413c200f09045814c02 --- src/IntBookmarkData.cpp | 5 ++++- src/IntBookmarkListForm.cpp | 6 ++++++ src/IntBookmarkPresentationModel.cpp | 1 + src/IntCreateBookmarkFolderForm.cpp | 6 +----- src/IntEditBookmarkListForm.cpp | 8 ++++++-- src/IntFaviconManager.cpp | 2 +- src/IntHistory.cpp | 6 +++++- src/IntHistoryPresentationModel.cpp | 8 +++++++- src/IntMainForm.cpp | 28 +++++++++++++++++++++++----- src/IntPresentationModelBase.cpp | 1 + 10 files changed, 55 insertions(+), 16 deletions(-) diff --git a/src/IntBookmarkData.cpp b/src/IntBookmarkData.cpp index f8bd8df..b804daa 100644 --- a/src/IntBookmarkData.cpp +++ b/src/IntBookmarkData.cpp @@ -56,7 +56,10 @@ BookmarkData::BookmarkData(const BookmarkData& bookmark) BookmarkData::~BookmarkData(void) { - + if (__pFavIconData) + { + delete __pFavIconData; + } } BookmarkData& diff --git a/src/IntBookmarkListForm.cpp b/src/IntBookmarkListForm.cpp index 16be6d5..42b1a56 100644 --- a/src/IntBookmarkListForm.cpp +++ b/src/IntBookmarkListForm.cpp @@ -1145,6 +1145,12 @@ BookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI __previousSceneId = previousSceneId; }*/ + if (pList) + { + delete pList; + pList = null; + } + if (__pListview != null) { __pListview->UpdateList(); diff --git a/src/IntBookmarkPresentationModel.cpp b/src/IntBookmarkPresentationModel.cpp index a523297..6dfdcd8 100644 --- a/src/IntBookmarkPresentationModel.cpp +++ b/src/IntBookmarkPresentationModel.cpp @@ -91,6 +91,7 @@ void BookmarkPresentationModel::DestroyInstance(void) { if (__pBookmarkPresentationModel) { + __pBookmarkPresentationModel->UnInitialize(); delete __pBookmarkPresentationModel; __pBookmarkPresentationModel = null; } diff --git a/src/IntCreateBookmarkFolderForm.cpp b/src/IntCreateBookmarkFolderForm.cpp index 1a1e9d8..e382218 100644 --- a/src/IntCreateBookmarkFolderForm.cpp +++ b/src/IntCreateBookmarkFolderForm.cpp @@ -242,11 +242,7 @@ CreateBookmarkFolderForm::OnSceneActivatedN(const SceneId& previousSceneId, cons void CreateBookmarkFolderForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) { - if (__pBookmark) - { - delete __pBookmark; - __pBookmark= null; - } + } void diff --git a/src/IntEditBookmarkListForm.cpp b/src/IntEditBookmarkListForm.cpp index fd395f7..57c3baf 100644 --- a/src/IntEditBookmarkListForm.cpp +++ b/src/IntEditBookmarkListForm.cpp @@ -97,6 +97,7 @@ EditBookmarkListForm::Initialize(void) return true; } + result EditBookmarkListForm::OnInitializing(void) { @@ -707,7 +708,6 @@ EditBookmarkListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& __pSelectedList->Add(pBookmarkId); } - int itemCount = __pListview->GetItemCount(); for (int count = 0;count < itemCount ; count++) { @@ -845,9 +845,13 @@ EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const Sc { __pListview->SetItemChecked(index,false); } + if (pBookmarkId) + { + delete pBookmarkId; + pBookmarkId = null; + } } - /*labelString.Append(CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED")); labelString.Append(L"\x200E"); // LEFT-TO-RIGHT MARK labelString.Append(L"("); diff --git a/src/IntFaviconManager.cpp b/src/IntFaviconManager.cpp index ffe5986..b4104dc 100644 --- a/src/IntFaviconManager.cpp +++ b/src/IntFaviconManager.cpp @@ -81,13 +81,13 @@ FaviconManager::CreateInstance(void) return; } std::atexit(DestroyInstance); - } void FaviconManager::DestroyInstance(void) { if (__pFaviconManagerInstance) { + __pFaviconManagerInstance->UnInitialize(); delete __pFaviconManagerInstance; __pFaviconManagerInstance = null; } diff --git a/src/IntHistory.cpp b/src/IntHistory.cpp index 85f1fd7..a62ad5a 100644 --- a/src/IntHistory.cpp +++ b/src/IntHistory.cpp @@ -63,10 +63,14 @@ History::History(const History& hs) History::~History(void) { - if(__pThumbnail != null) + if (__pThumbnail != null) { delete __pThumbnail; //TODO To get this reviewed } + if (__pFavIconData) + { + delete __pFavIconData; + } AppLog("History::~History()"); } diff --git a/src/IntHistoryPresentationModel.cpp b/src/IntHistoryPresentationModel.cpp index 4159c15..db189a4 100644 --- a/src/IntHistoryPresentationModel.cpp +++ b/src/IntHistoryPresentationModel.cpp @@ -70,6 +70,7 @@ void HistoryPresentationModel::DestroyInstance(void) { if (__pHistoryPresentationModel) { + __pHistoryPresentationModel->UnInitialize(); delete __pHistoryPresentationModel; __pHistoryPresentationModel = null; } @@ -413,6 +414,12 @@ HistoryPresentationModel::SaveTempHistory(History& history) } } + if (pTodaysList) + { + pTodaysList->RemoveAll(); + delete pTodaysList; + } + pMostVisitedSites = new(std::nothrow) ArrayList(); pMostVisitedSites->Construct(); String historyTitle = history.GetHistoryTitle(); @@ -1119,7 +1126,6 @@ HistoryPresentationModel::GetHistoryWithTimeRange(Tizen::Base::DateTime& startTi result HistoryPresentationModel::GetMostVisitedSites(ArrayList& pHistoryList) { - int count = -1; String query; String historyTable(HISTORY_DATA_TABLE); diff --git a/src/IntMainForm.cpp b/src/IntMainForm.cpp index 4fc3f32..4bc10dc 100644 --- a/src/IntMainForm.cpp +++ b/src/IntMainForm.cpp @@ -1118,6 +1118,7 @@ MainForm::InitFindWordPanel(void) __pFindWordEditField->AddTextEventListener(*this); __pFindWordEditField->AddKeypadEventListener(*this); __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false); + __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00)); __pFindWordEditFieldRightToLeft = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true)); if (__pFindWordEditFieldRightToLeft == null) @@ -1128,7 +1129,7 @@ MainForm::InitFindWordPanel(void) __pFindWordEditFieldRightToLeft->AddTextEventListener(*this); __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this); __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false); - + __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00)); return r; } @@ -1327,14 +1328,23 @@ MainForm::OnTerminating(void) __pWebViewer->RemoveTouchEventListener(*this); } - if(__pItemContext) + if (__pItemContext) { delete __pItemContext; } - if(__pItemContextLandscape) + if (__pItemContextLandscape) { delete __pItemContextLandscape; } + if (__pSaveImage) + { + delete __pSaveImage; + } + if (__pMostVisitedSites) + { + __pMostVisitedSites->RemoveAll(true); + delete __pMostVisitedSites; + } return r; } @@ -2593,10 +2603,11 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue); pSelectedScene = (String*) pValue; - if (pSelectedScene != null) + // removed because some times crash is happening here + /*if (pSelectedScene != null) { delete pSelectedScene; - } + }*/ MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null); String* selectedSceneID = new(std::nothrow) String(currentSceneId); AppLogDebug("current scene id is %ls", currentSceneId.GetPointer()); @@ -2622,6 +2633,12 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0)); } + if (selectedSceneID) + { + delete selectedSceneID; + selectedSceneID = null; + } + InitFooter(); InitAddressbar(); @@ -2771,6 +2788,7 @@ MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap(); WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight())); delete pCanvas; + delete pWebCanvas; AppLog("Coming here"); } diff --git a/src/IntPresentationModelBase.cpp b/src/IntPresentationModelBase.cpp index 16e70e0..7e53afd 100644 --- a/src/IntPresentationModelBase.cpp +++ b/src/IntPresentationModelBase.cpp @@ -469,6 +469,7 @@ PresentationModelBase::ExecuteBookmarkQuery(const Tizen::Base::String& formatQue { AppLog("PresentationModelBase::ExecuteBookmarkQuery success database"); } + delete pFormatter; } else if (__isBeginTransaction == false && (queryType == L"UPDATE" || queryType == L"DELETE")) { -- 2.7.4