summaryrefslogtreecommitdiff
path: root/services/SettingsUI
diff options
context:
space:
mode:
authorKamil Nowac <k.nowac@samsung.com>2016-05-17 08:52:34 +0200
committerKamil Nowac <k.nowac@samsung.com>2016-05-17 09:33:26 +0200
commit726371c34f6e7e5b0453694f32f2bbd3dcf3afbd (patch)
tree99aa05088bade9da7a7210e997570e4851ac4b3c /services/SettingsUI
parent6b1d828584e9fcb534c200e364775d473fb18a42 (diff)
downloadbrowser-726371c34f6e7e5b0453694f32f2bbd3dcf3afbd.tar.gz
browser-726371c34f6e7e5b0453694f32f2bbd3dcf3afbd.tar.bz2
browser-726371c34f6e7e5b0453694f32f2bbd3dcf3afbd.zip
Prevent crash issue in Autofill forms
[Issue] http://suprem.sec.samsung.net/jira/browse/TSAM-3408 [Problem] Browser crashes [Solution] Changed item removal method [Verify] Add few records in autofill forms. remove at random -> Browser should not crash Change-Id: Ic7eec04ad73a05784b026e0aaeec8e2fad9e03d9
Diffstat (limited to 'services/SettingsUI')
-rwxr-xr-xservices/SettingsUI/AutoFillForm/AutoFillFormManager.cpp20
-rw-r--r--services/SettingsUI/AutoFillForm/AutoFillFormManager.h1
-rw-r--r--services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp4
3 files changed, 15 insertions, 10 deletions
diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp
index f74e5f32..b733f787 100755
--- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp
+++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.cpp
@@ -114,15 +114,19 @@ Eina_Bool AutoFillFormManager::addItemToList(AutoFillFormItem *item)
Eina_Bool AutoFillFormManager::deleteAutoFillFormItem(AutoFillFormItem *item)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- for (unsigned int i = 0; i < m_AutoFillFormItemList.size(); i++) {
- if (m_AutoFillFormItemList[i]->getProfileId() == item->getProfileId()) {
- if (ewk_context_form_autofill_profile_remove(m_ewkContext, item->getProfileId()) == EINA_FALSE)
- return EINA_FALSE;
-
- m_AutoFillFormItemList.erase(m_AutoFillFormItemList.begin() + i);
- }
- }
+ m_AutoFillFormItemList.erase(
+ std::remove_if(
+ m_AutoFillFormItemList.begin(),
+ m_AutoFillFormItemList.end(),
+ [&](AutoFillFormItem* el) -> Eina_Bool {
+ return (el->getProfileId() == item->getProfileId()) ?
+ ewk_context_form_autofill_profile_remove(m_ewkContext, item->getProfileId()) :
+ EINA_FALSE;
+ }
+ ),
+ m_AutoFillFormItemList.end()
+ );
return EINA_TRUE;
}
diff --git a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h
index f5d5db03..329078c5 100644
--- a/services/SettingsUI/AutoFillForm/AutoFillFormManager.h
+++ b/services/SettingsUI/AutoFillForm/AutoFillFormManager.h
@@ -62,6 +62,7 @@ public:
Eina_Bool deleteDeleteView(void);
Eina_Bool deleteComposer(void);
std::vector<AutoFillFormItem *> getItemList(void) { return m_AutoFillFormItemList; }
+ AutoFillFormItem* getItem(unsigned it){ return m_AutoFillFormItemList[it];}
std::vector<AutoFillFormItem *> loadEntireItemList(void);
Eina_Bool addItemToList(AutoFillFormItem *item);
void rotateLandscape();
diff --git a/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp b/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp
index 5c74f442..00b7b8b5 100644
--- a/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp
+++ b/services/SettingsUI/AutoFillForm/AutoProfileDeleteView.cpp
@@ -307,7 +307,7 @@ void AutoProfileDeleteView::deleteSelectedItems(void)
checkbox = elm_object_item_part_content_get(it, "checkbox");
cb_data = static_cast<genlistCallbackData*>(elm_object_item_data_get(it));
if (elm_check_state_get(checkbox)) {
- AutoFillFormItem *item = m_manager->getItemList()[cb_data->menu_index - del_count];
+ AutoFillFormItem *item = m_manager->getItem(cb_data->menu_index - del_count);
m_manager->deleteAutoFillFormItem(item);
del_count++;
m_checkbox_delete_state_map.erase(it);
@@ -338,7 +338,7 @@ const char *AutoProfileDeleteView::getEachItemFullName(unsigned int index)
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_manager->getAutoFillFormItemCount() == 0)
return NULL;
- return (m_manager->getItemList())[index]->getName();
+ return (m_manager->getItem(index))->getName();
}
Evas_Object *AutoProfileDeleteView::__content_get_cb(void* data, Evas_Object* obj, const char *part)