Fixed Nabi issue and major memory leaks by valgrind
authorrahul sharma <rahul.dutt@samsung.com>
Tue, 2 Jul 2013 04:40:35 +0000 (13:40 +0900)
committerrahul sharma <rahul.dutt@samsung.com>
Tue, 2 Jul 2013 04:40:35 +0000 (13:40 +0900)
Change-Id: I330ec103efb082487f7a8413c200f09045814c02

src/IntBookmarkData.cpp
src/IntBookmarkListForm.cpp
src/IntBookmarkPresentationModel.cpp
src/IntCreateBookmarkFolderForm.cpp
src/IntEditBookmarkListForm.cpp
src/IntFaviconManager.cpp
src/IntHistory.cpp
src/IntHistoryPresentationModel.cpp
src/IntMainForm.cpp
src/IntPresentationModelBase.cpp

index f8bd8df..b804daa 100644 (file)
@@ -56,7 +56,10 @@ BookmarkData::BookmarkData(const BookmarkData& bookmark)
 
 BookmarkData::~BookmarkData(void)
 {
-
+       if (__pFavIconData)
+       {
+               delete __pFavIconData;
+       }
 }
 
 BookmarkData&
index 16be6d5..42b1a56 100644 (file)
@@ -1145,6 +1145,12 @@ BookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI
                __previousSceneId = previousSceneId;
        }*/
 
+       if (pList)
+       {
+               delete pList;
+               pList = null;
+       }
+
        if (__pListview != null)
        {
                __pListview->UpdateList();
index a523297..6dfdcd8 100644 (file)
@@ -91,6 +91,7 @@ void BookmarkPresentationModel::DestroyInstance(void)
 {
        if (__pBookmarkPresentationModel)
        {
+               __pBookmarkPresentationModel->UnInitialize();
                delete __pBookmarkPresentationModel;
                __pBookmarkPresentationModel = null;
        }
index 1a1e9d8..e382218 100644 (file)
@@ -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
index fd395f7..57c3baf 100644 (file)
@@ -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"(");
index ffe5986..b4104dc 100644 (file)
@@ -81,13 +81,13 @@ FaviconManager::CreateInstance(void)
                return;
        }
        std::atexit(DestroyInstance);
-
 }
 
 void FaviconManager::DestroyInstance(void)
 {
        if (__pFaviconManagerInstance)
        {
+               __pFaviconManagerInstance->UnInitialize();
                delete __pFaviconManagerInstance;
                __pFaviconManagerInstance = null;
        }
index 85f1fd7..a62ad5a 100644 (file)
@@ -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()");
 }
 
index 4159c15..db189a4 100644 (file)
@@ -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);
index 4fc3f32..4bc10dc 100644 (file)
@@ -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<EditField*>(__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");
 }
 
index 16e70e0..7e53afd 100644 (file)
@@ -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"))
                        {