From c0e4e154d45a53eb46427fa8d6cba7addd650db4 Mon Sep 17 00:00:00 2001 From: Sergei Kobec Date: Thu, 18 Aug 2016 11:44:03 +0300 Subject: [PATCH] TizenRefApp-6953 Crash when initiating outgoing call TizenRefApp-6955 Crash when adding some MFC to favourites Change-Id: I36b573ca208fd33cef7a2e9b295c742137b64974 Signed-off-by: Sergei Kobec --- lib-contacts/src/Contacts/List/Model/MfcProvider.cpp | 10 ++++++---- lib-contacts/src/Contacts/List/Model/PersonProvider.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib-contacts/src/Contacts/List/Model/MfcProvider.cpp b/lib-contacts/src/Contacts/List/Model/MfcProvider.cpp index 2b2e4c5..5e95351 100644 --- a/lib-contacts/src/Contacts/List/Model/MfcProvider.cpp +++ b/lib-contacts/src/Contacts/List/Model/MfcProvider.cpp @@ -64,15 +64,17 @@ contacts_record_h MfcProvider::getPersonRecord(int id, PersonProvider::IdType id return nullptr; } - for (auto &&usageRecord : makeRange(getPersonUsageList())) { + contacts_record_h record = nullptr; + contacts_list_h list = getPersonUsageList(); + for (auto &&usageRecord : makeRange(list)) { if (getRecordInt(usageRecord, _contacts_person_usage.person_id) == id) { - contacts_record_h record = nullptr; contacts_db_get_record(_contacts_person._uri, id, &record); - return record; + break; } } - return nullptr; + contacts_list_destroy(list, true); + return record; } void MfcProvider::insertPerson(contacts_record_h personRecord) diff --git a/lib-contacts/src/Contacts/List/Model/PersonProvider.cpp b/lib-contacts/src/Contacts/List/Model/PersonProvider.cpp index ef85258..322fa57 100644 --- a/lib-contacts/src/Contacts/List/Model/PersonProvider.cpp +++ b/lib-contacts/src/Contacts/List/Model/PersonProvider.cpp @@ -78,7 +78,7 @@ void PersonProvider::reload() PersonProvider::insertPerson(record); } - contacts_list_destroy(list, true); + contacts_list_destroy(list, false); } void PersonProvider::setUpdateMode(bool isEnabled) @@ -287,7 +287,7 @@ void PersonProvider::updatePersonList() case CONTACTS_CHANGE_UPDATED: { int personId = getPersonId(contactId); - contacts_record_h personRecord = getPersonRecord(contactId, ContactId); + contacts_record_h personRecord = getPersonRecord(personId, PersonId); auto personIt = findPerson(personId, PersonId); if (personIt != m_PersonList.end()) { -- 2.7.4