From: Amith Kumar Mahale Date: Mon, 1 Jul 2013 14:07:06 +0000 (+0530) Subject: Memory leaks fixed. Fix for 44222 44125 44118 X-Git-Tag: submit/tizen_2.2/20130714.134531~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01a0fe49cd073ccc5b4c4d35e980c3395084eadb;p=apps%2Fosp%2FDial.git Memory leaks fixed. Fix for 44222 44125 44118 Change-Id: Id7bcd48df0ab5b6ef6a52ba71ef21316f7c4c823 Signed-off-by: Amith Kumar Mahale --- diff --git a/res/screen-size-normal/IDL_SETTINGS_ADD_EDIT_REJECT_MSGS_FORM.xml b/res/screen-size-normal/IDL_SETTINGS_ADD_EDIT_REJECT_MSGS_FORM.xml index 4e19b70..37b8d8c 100644 --- a/res/screen-size-normal/IDL_SETTINGS_ADD_EDIT_REJECT_MSGS_FORM.xml +++ b/res/screen-size-normal/IDL_SETTINGS_ADD_EDIT_REJECT_MSGS_FORM.xml @@ -3,29 +3,24 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- - + +
- +
- - - - - - - - - + + + +
diff --git a/src/PhnCallLogViewByPopup.cpp b/src/PhnCallLogViewByPopup.cpp index 1d0ebf1..e6094af 100644 --- a/src/PhnCallLogViewByPopup.cpp +++ b/src/PhnCallLogViewByPopup.cpp @@ -86,6 +86,11 @@ CallLogViewByPopup::CallLogViewByPopup(ICallLogViewByPopupListener& listener) CallLogViewByPopup::~CallLogViewByPopup() { + if(__pOptionsList != null) + { + delete __pOptionsList; + __pOptionsList = null; + } } result diff --git a/src/PhnCalllogManager.cpp b/src/PhnCalllogManager.cpp index 2752b70..9e9ec7a 100644 --- a/src/PhnCalllogManager.cpp +++ b/src/PhnCalllogManager.cpp @@ -459,6 +459,11 @@ CallLogManager::~CallLogManager(void) delete __pNumber; __pNumber = null; } + if(__pCalllogDBIds != null) + { + __pCalllogDBIds->RemoveAll(); + delete __pCalllogDBIds; + } if(__pCalllogChangeListerners != null) { delete __pCalllogChangeListerners; @@ -525,6 +530,7 @@ CallLogManager::CopyDataToCallLogDetails(CallLogDetails* calllogInfo , contacts_ if(ret == 0 && address != null) { calllogInfo->SetPhoneNumber(address); + free(address); } int duration=0; @@ -612,6 +618,7 @@ CallLogManager::GetAllCallogDataFromDatabseCB() } contacts_record_destroy(getrec,true); } + contacts_list_destroy(list,false); return true; } @@ -805,6 +812,7 @@ CallLogManager::UpdateCallLogList() { __pCalllogDBIds->RemoveAll(); delete __pCalllogDBIds; + __pCalllogDBIds = null; } __pCalllogGroupList = new (std::nothrow) ArrayList(); @@ -1245,6 +1253,7 @@ void CallLogManager::GetCalllogContactName(String number,String& name) } contacts_record_destroy(getrec,true); } + delete pByteBuffer; } void CallLogManager::ContactsDbchangedcb(const char* view_uri, void* user_data) diff --git a/src/PhnCommonUtils.cpp b/src/PhnCommonUtils.cpp index aad8ada..94274cb 100644 --- a/src/PhnCommonUtils.cpp +++ b/src/PhnCommonUtils.cpp @@ -295,7 +295,11 @@ DialUtil::DrawBitmapToCanvas(Tizen::Graphics::Canvas& pCanvas, const Tizen::Base { AppResource* pAppResource = AppResource::GetInstance(); Bitmap* pBitmap = pAppResource->GetBitmapN(bgImg); - pCanvas.DrawBitmap(pCanvas.GetBounds(),*pBitmap); + if(pBitmap != null) + { + pCanvas.DrawBitmap(pCanvas.GetBounds(),*pBitmap); + delete pBitmap; + } } void @@ -465,7 +469,6 @@ DialUtil::DrawKeypadTextToCanvas(const String& buttonText, int textFontStyle, Ca { case POSITION_BOTTOM_CENTER: { - int width = pEnrichedText->GetWidth(); textPos.SetPosition(((pCanvas.GetBounds().width - pEnrichedText->GetWidth()) / 2), 20 + pCanvas.GetBounds().height / 2 + ((pCanvas.GetBounds().height / 2 diff --git a/src/PhnDialPresentationModel.cpp b/src/PhnDialPresentationModel.cpp index 3e6b473..e18c29d 100644 --- a/src/PhnDialPresentationModel.cpp +++ b/src/PhnDialPresentationModel.cpp @@ -52,6 +52,7 @@ DialPresentationModel::DialPresentationModel(DialTabDialer& parentPanel) : __par DialPresentationModel::~DialPresentationModel() { AppLogDebug("ENTER"); + AppControl::StopAppControlResponseListener(this); ClearSearchResults(); AppLogDebug("EXIT"); } @@ -187,9 +188,7 @@ DialPresentationModel::HandleContactsRetrievalCompleted(IList* pContactsList) __pSearchString = null; } //Show "Add to contact" - ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter); - pArgs->Construct(); - __parentDialerPanel.SendUserEvent(REQUEST_SHOW_ADD_TO_CONTACTS,pArgs); + __parentDialerPanel.SendUserEvent(REQUEST_SHOW_ADD_TO_CONTACTS,null); //empty list delete pContactsList; pContactsList = null; diff --git a/src/PhnLogsDetailForm.cpp b/src/PhnLogsDetailForm.cpp index 96de6fb..58e62c5 100644 --- a/src/PhnLogsDetailForm.cpp +++ b/src/PhnLogsDetailForm.cpp @@ -847,6 +847,8 @@ DlLogsDetailForm::ManageUserDetail() ContactNameTextfont->Construct(FONT_STYLE_BOLD, fontSize); FloatDimension textDimension; ContactNameTextfont->GetTextExtent(contactNameStr, contactNameStr.GetLength(), textDimension); + delete ContactNameTextfont; + delete pTextElement; float width = 0.0; String countString = L"(" + Integer::ToString(__calllogCount) + L")"; float countStringWidth = 0.0; @@ -910,6 +912,8 @@ DlLogsDetailForm::GetTextWidthHeight(String str, float fontSize, float *width, f ContactNameTextfont->GetTextExtent(str, str.GetLength(), textDimension); *width = textDimension.width; *height = textDimension.height; + delete ContactNameTextfont; + delete pTextElement; } void @@ -1231,18 +1235,27 @@ DlLogsDetailForm::HideDeletePopup(void) __isDeleteInProgress = false; __deleteGroupIndex = 0; __deleteItemIndex = 0; + //__isEditMode = false; if (__pDeletePopup != null) { __pDeletePopup->SetShowState(false); __pDeletePopup->Invalidate(true); } - if (__calllogListByNum->GetItemsN(0, __calllogListByNum->GetCount())->GetCount() != __selectedItemCount) + if (__calllogListByNum->GetCount() != __selectedItemCount) { const wchar_t* pContact = __number.GetPointer(); int len = __number.GetLength() + 1; char* pNumber = new (std::nothrow) char[len]; wcstombs(pNumber, pContact, len); + if(__calllogListByNum != null) + { + AppLog(" list already present, UPDATE"); + __calllogListByNum->RemoveAll(); + delete __calllogListByNum; + __calllogListByNum = null; + } __calllogListByNum = __pLogPresentor->GetCallogListByNumberFromDatabaseN(pNumber); + delete[] pNumber; UpdateForm(); SetFormMode(false); __pList->UpdateList(); diff --git a/src/PhnLogsDetailItemProvider.cpp b/src/PhnLogsDetailItemProvider.cpp index d3340a6..14313fb 100644 --- a/src/PhnLogsDetailItemProvider.cpp +++ b/src/PhnLogsDetailItemProvider.cpp @@ -123,6 +123,12 @@ LogsDetailItemProvider::~LogsDetailItemProvider() __pCalllogDetailListByNumber->RemoveAll(); delete __pCalllogDetailListByNumber; } + if(__pCallLogDetailGroups != null) + { + __pCallLogDetailGroups->RemoveAll(); + delete __pCallLogDetailGroups; + __pCallLogDetailGroups = null; + } } void @@ -770,6 +776,6 @@ LogsDetailItemProvider::GetTimeText(DateTime calllogDate,String& dateText) } else { - dateText.Format(MAX_TWENTYFOUR_FORMAT_LENGTH,L"%02d:02%d", calllogDate.GetHour(), calllogDate.GetMinute()); + dateText.Format(MAX_TWENTYFOUR_FORMAT_LENGTH,L"%02d:%02d", calllogDate.GetHour(), calllogDate.GetMinute()); } } diff --git a/src/PhnSettingsManager.cpp b/src/PhnSettingsManager.cpp index bdb04d6..f65a811 100644 --- a/src/PhnSettingsManager.cpp +++ b/src/PhnSettingsManager.cpp @@ -1974,6 +1974,7 @@ SettingsManager::GetMsgFilterListIndex(const String& phoneNumber) msg_release_list_struct(__pFilterList); delete __pFilterList; + __pFilterList = null; __pNumberFilterIndex->RemoveAll(); CloseMsgHandleSession(); diff --git a/src/PhnTabDialer.cpp b/src/PhnTabDialer.cpp index 2ab0e05..7bd1c6f 100644 --- a/src/PhnTabDialer.cpp +++ b/src/PhnTabDialer.cpp @@ -263,7 +263,6 @@ DialTabDialer::ShowFormattedText(EditField* pEditField, String contactNumber) if(textLength == 0) { pEditField->Clear(); - pEditField->SetFocus(); pEditField->Invalidate(true); AppLogDebug("EXIT"); return; @@ -379,7 +378,6 @@ DialTabDialer::ShowFormattedText(EditField* pEditField, int actionId) if(textLength == 0) { pEditField->Clear(); - pEditField->SetFocus(); pEditField->Invalidate(true); AppLogDebug("EXIT"); return; @@ -1906,7 +1904,6 @@ DialTabDialer::OnForeground(void) { ShowFormattedText(pEditField,editText); //pEditField->SetCursorPosition(editText.GetLength()); - pEditField->SetFocus(); pEditField->Invalidate(true); //show search results if (pEditField->GetTextLength() == 0) diff --git a/src/PhnTabLogs.cpp b/src/PhnTabLogs.cpp index 04da798..19c90c5 100644 --- a/src/PhnTabLogs.cpp +++ b/src/PhnTabLogs.cpp @@ -51,6 +51,9 @@ const int H_SELECTALL_CHK_BOX = 112; const wchar_t* IDL_PANEL_LOGS = L"IDL_PANEL_LOGS"; const wchar_t* IDC_LABEL_SELECTED_POPUP = L"IDC_LABEL_SELECTED_POPUP"; const unsigned int COLOR_LABEL_SELECTED = Color32<215, 225, 232, 255>::Value; +static const unsigned int COLOR_ITEM_DELETE_TEXT = Color32<255, 255, 255>::Value; +static const unsigned int COLOR_ITEM_DELETE_BACKGROUND = Color32<208, 82, 82>::Value; +static const unsigned int COLOR_ITEM_DELETE_PRESSED_BACKGROUND = Color32<194, 71, 71>::Value; static const int W_DELETE_POPUP = 720; static const int H_DELETE_POPUP = 308; @@ -194,6 +197,7 @@ DialTabLogs::OnInitializing(void) if(pNoContentBitmap != null) { __plogsListView->SetBitmapOfEmptyList(pNoContentBitmap); + } __plogsListView->SetTextOfEmptyList(AppUtility::GetResourceString(IDS_NO_LOGS)); __plogsListView->SetTextColorOfEmptyList(Color(128,128,128)); @@ -431,22 +435,29 @@ DialTabLogs::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, } __pGroupContextDeletePopup = new (std::nothrow) Popup(); - __pGroupContextDeletePopup->Construct(true, Dimension(640,250)); + __pGroupContextDeletePopup->Construct(false, Dimension(688,230)); __pGroupContextDeletePopup->SetPropagatedKeyEventListener(this); - __pGroupContextDeletePopup->SetTitleText(AppUtility::GetResourceString(IDS_DELETE_CONFORMATION_STRING)); + Label *pDeleteTitle = new Label(); + pDeleteTitle->Construct(Rectangle(16,32,656,80), AppUtility::GetResourceString(IDS_DELETE_CONFORMATION_STRING)); + pDeleteTitle->SetTextConfig(38, LABEL_TEXT_STYLE_BOLD); + pDeleteTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + pDeleteTitle->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pGroupContextDeletePopup->AddControl(pDeleteTitle); //Yes button - Rectangle yesRect(10, 80, 300, 80); + Rectangle yesRect(16, 132, 318, 74); Button* pYesButton = new Button(); pYesButton->Construct(yesRect, AppUtility::GetResourceString(IDS_DELETE_YES)); pYesButton->SetActionId(IDA_POPUP_DELETE_YES); pYesButton->AddActionEventListener(*this); + pYesButton->SetColor(BUTTON_STATUS_NORMAL, Color(COLOR_ITEM_DELETE_BACKGROUND)); + pYesButton->SetColor(BUTTON_STATUS_PRESSED, Color(COLOR_ITEM_DELETE_PRESSED_BACKGROUND)); __pGroupContextDeletePopup->AddControl(pYesButton); //No button - yesRect.x = yesRect.x + yesRect.width + 10; + Rectangle noRect(354, 132, 318, 74); Button* pNoButton = new Button(); - pNoButton->Construct(yesRect, AppUtility::GetResourceString(IDS_DELETE_NO)); + pNoButton->Construct(noRect, AppUtility::GetResourceString(IDS_DELETE_NO)); pNoButton->SetActionId(IDA_POPUP_DELETE_NO); pNoButton->AddActionEventListener(*this); __pGroupContextDeletePopup->AddControl(pNoButton); @@ -976,7 +987,7 @@ DialTabLogs::RemoveLogsList(void) r = E_SUCCESS; __deleteGroupIndex = groupIndex; __deleteItemIndex = ++itemIndex; - __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId()))); + __pCallLogId->Remove(Integer(pCalllogInfo->GetCalllogDbId())); return r; } } @@ -1096,7 +1107,7 @@ DialTabLogs::StoreItemselection(int groupIndex, int itemIndex, int elementId, Li else if (state == LIST_ITEM_STATUS_UNCHECKED) { __pDataProvider->GetItemAtGroupIndex(groupIndex, itemIndex, &pCalllogInfo); - __pCallLogId->Remove(*(new Integer(pCalllogInfo->GetCalllogDbId()))); + __pCallLogId->Remove(Integer(pCalllogInfo->GetCalllogDbId())); } } void @@ -1130,7 +1141,7 @@ DialTabLogs:: ManageItemSelection(void) } else { - if(__pCallLogId->Contains(*(new Integer(pCalllogInfo->GetCalllogDbId())))) + if(__pCallLogId->Contains(Integer(pCalllogInfo->GetCalllogDbId()))) { __plogsListView->SetItemChecked(groupIndex,itemIndex,true); ++__selectedItemCount; diff --git a/src/PhnTabLogsItemProvider.cpp b/src/PhnTabLogsItemProvider.cpp index 65355f8..ca7320d 100644 --- a/src/PhnTabLogsItemProvider.cpp +++ b/src/PhnTabLogsItemProvider.cpp @@ -58,6 +58,10 @@ const wchar_t* IDS_VOICE_CALL_CONTEXT_ITEM = L"IDS_VOICE_CALL_BTN_NAME"; const wchar_t* IDS_LEFT_BRACE = L" ("; const wchar_t* IDS_RIGHT_BRACE = L")"; +static const unsigned int COLOR_ITEM_DELETE_TEXT = Color32<255, 255, 255>::Value; +static const unsigned int COLOR_ITEM_DELETE_BACKGROUND = Color32<208, 82, 82>::Value; +static const unsigned int COLOR_ITEM_DELETE_PRESSED_BACKGROUND = Color32<194, 71, 71>::Value; + CustomDataProvider::CustomDataProvider(void) { __isEditStyle = false; @@ -73,6 +77,11 @@ CustomDataProvider::CustomDataProvider(void) __pItemContext->AddElement(IDA_LIST_ELEMENT_VIDEO_CALL, videoCallStr, false); String delStr = AppUtility::GetResourceString(IDS_DELETE_BTN_STRING); __pItemContext->AddElement(IDA_LIST_ELEMENT_DELETE, delStr); + __pItemContext->SetElementBackgroundColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, Color(COLOR_ITEM_DELETE_BACKGROUND)); + __pItemContext->SetElementBackgroundColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED, Color(COLOR_ITEM_DELETE_PRESSED_BACKGROUND)); + __pItemContext->SetElementBackgroundColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED, Color(COLOR_ITEM_DELETE_PRESSED_BACKGROUND)); + __pItemContext->SetElementTextColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, Color(COLOR_ITEM_DELETE_TEXT)); + __pItemContextForMMLogs = new ListContextItem(); __pItemContextForMMLogs->Construct(); @@ -266,7 +275,7 @@ CustomDataProvider::CreateItem(int groupIndex, int itemIndex, int itemWidth) } else { - dateText.Format(MAX_TWENTYFOUR_FORMAT_LENGTH,L"%02d:02%d", calllogDate.GetHour(), calllogDate.GetMinute()); + dateText.Format(MAX_TWENTYFOUR_FORMAT_LENGTH,L"%02d:%02d", calllogDate.GetHour(), calllogDate.GetMinute()); } } @@ -370,7 +379,7 @@ CustomDataProvider::CreateItem(int groupIndex, int itemIndex, int itemWidth) pItem->AddElement(Rectangle((itemWidth - X_TEXT_TIME_ITEM_RIGHT_MARGIN) - 90, (Y_TEXT_LINE1_ITEM + __fontSize), W_TEXT_TIME_ITEM, H_TEXT_TIME_ITEM), ID_TIME_STRING, *pText); } - pBitmap = pAppResource->GetBitmapN(IDB_LOG_CALL_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmap = null; Bitmap* pLogTypeBitmap = null; @@ -417,7 +426,8 @@ CustomDataProvider::CreateItem(int groupIndex, int itemIndex, int itemWidth) if (pText != null) { delete pText; - } + } + return pItem; } @@ -430,6 +440,8 @@ CustomDataProvider::GetTextWidth(String contactName) ContactNameTextfont->Construct(FONT_STYLE_PLAIN, __fontSize); FloatDimension textDimension; ContactNameTextfont->GetTextExtent(contactName, contactName.GetLength(), textDimension); + delete pTextElement; + delete ContactNameTextfont; return textDimension.width; } @@ -443,7 +455,6 @@ CustomDataProvider::GetCallogIconBitmap(CallLogType logType,Bitmap*& iconType, B { iconType = pAppResource->GetBitmapN(IDB_LOG_CALL_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888); iconArrow = pAppResource->GetBitmapN(IDB_LOG_RECEIVEDCALL_ICON ,BITMAP_PIXEL_FORMAT_ARGB8888); - } break; case CALL_LOG_TYPE_VOICE_OUTGOING: