Remove back pointer from GenGroupItemData 73/195173/5
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Tue, 11 Dec 2018 07:49:57 +0000 (08:49 +0100)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Wed, 16 Jan 2019 09:44:09 +0000 (09:44 +0000)
Change-Id: I77a2a6205274fdb922dd78c6a5daea9adac8fb4a

src/GenGroupItemData.hpp
src/MainPage.cpp
src/ScreenReaderPage.cpp
src/ScreenReaderSettingsPage.cpp
src/UniversalSwitchPage.cpp
src/setting-common-draw-genlist.cpp
src/setting-debug.h

index 8ca472f..d8ba6fe 100644 (file)
@@ -41,7 +41,6 @@ enum class SwallowType : int {
 class GenGroupItemData
 {
 public:
-       void **pBack = nullptr;
        Evas_Object *window = nullptr;
        Evas *evas = nullptr;
 
index f72762f..471930d 100644 (file)
@@ -27,10 +27,8 @@ MainPage::MainPage(SettingAccessibility *ad)
                                                        "IDS_ST_MBODY_SCREEN_READER_HTTS",
                                                        screen_reader ? "IDS_ST_BODY_ON" : "IDS_ST_BODY_OFF",
                                                        NULL);
-       if (screenReaderItem_) {
+       if (screenReaderItem_)
                screenReaderItem_->userdata = ad;
-               __BACK_POINTER_SET(screenReaderItem_);
-       }
 
        universalSwitchItem_ = createGendialGroupItem(
                                                           scroller, &ad->itc_multiline_sub,
@@ -39,10 +37,8 @@ MainPage::MainPage(SettingAccessibility *ad)
                                                           "IDS_ACCS_UNIVERSAL_SWITCH",
                                                           "IDS_ACCS_UNIVERSAL_SWITCH_HINT",
                                                           NULL);
-       if (universalSwitchItem_) {
+       if (universalSwitchItem_)
                universalSwitchItem_->userdata = ad;
-               __BACK_POINTER_SET(universalSwitchItem_);
-       }
 
        accessibilityLauncherItem_ = createGendialGroupItem(
                                                                         scroller, &ad->itc_multiline_sub,
@@ -51,10 +47,8 @@ MainPage::MainPage(SettingAccessibility *ad)
                                                                         "IDS_ACCS_ACCESSIBILITY_LAUNCHER",
                                                                         "IDS_ACCS_ACCESSIBILITY_LAUNCHER_HINT",
                                                                         NULL);
-       if (accessibilityLauncherItem_) {
+       if (accessibilityLauncherItem_)
                accessibilityLauncherItem_->userdata = ad;
-               __BACK_POINTER_SET(accessibilityLauncherItem_);
-       }
 
        int vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, onScreenReaderVconfKeyChanged, screenReaderItem_);
        if (vconf_ret != 0) {
index 7d65b4e..97f632c 100644 (file)
@@ -35,10 +35,9 @@ ScreenReaderPage::ScreenReaderPage(SettingAccessibility *data)
                                                                ad, SwallowType::ICON_RADIO, 1,
                                                                "IDS_ST_MBODY_SCREEN_READER_HTTS",
                                                                {}, screenReaderCheckCb);
-       if (screenreader_checkbox) {
+       if (screenreader_checkbox)
                screenreader_checkbox->userdata = ad;
-               __BACK_POINTER_SET(screenreader_checkbox);
-       }
+
        int screen_reader = 0;
        auto r = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &screen_reader);
        if (!r)
@@ -64,8 +63,6 @@ ScreenReaderPage::ScreenReaderPage(SettingAccessibility *data)
                                                                                  NULL);
        if (multiline_screen_reader_comment) {
                multiline_screen_reader_comment->userdata = ad;
-               __BACK_POINTER_SET(multiline_screen_reader_comment);
-
                elm_genlist_item_select_mode_set(multiline_screen_reader_comment->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
        }
 
@@ -75,10 +72,8 @@ ScreenReaderPage::ScreenReaderPage(SettingAccessibility *data)
                                                                 ad, SwallowType::INVALID, 0,
                                                                 "IDS_ST_OPT_SETTINGS",
                                                                 {}, NULL);
-       if (screen_reader_settings) {
+       if (screen_reader_settings)
                screen_reader_settings->userdata = ad;
-               __BACK_POINTER_SET(screen_reader_settings);
-       }
 
        Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ST_MBODY_SCREEN_READER_HTTS"), NULL, NULL, genlist, NULL);
        elm_object_item_domain_text_translatable_set(navi_it, PACKAGE,
index b2be721..1d148e8 100644 (file)
@@ -95,7 +95,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
        tts_setting_set_speed_changed_cb(ttsSpeedChangedCb, speech_rate_item);
        if (speech_rate_item) {
                speech_rate_item->userdata = ad;
-               __BACK_POINTER_SET(speech_rate_item);
                speech_rate_list_item = speech_rate_item;
                SETTING_TRACE("Speech rate Item added");
        }
@@ -119,7 +118,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
 
        if (keyboard_feedback_item) {
                keyboard_feedback_item->userdata = ad;
-               __BACK_POINTER_SET(keyboard_feedback_item);
                SETTING_TRACE("Keyboard feedback Item added");
        }
 
@@ -142,7 +140,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
 
        if (hints_item) {
                hints_item->userdata = ad;
-               __BACK_POINTER_SET(hints_item);
                SETTING_TRACE("Hints Item added");
        }
 
@@ -165,7 +162,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
 
        if (vibration_feedback_item) {
                vibration_feedback_item->userdata = ad;
-               __BACK_POINTER_SET(vibration_feedback_item);
                SETTING_TRACE("Vibration feedback Item added");
        }
 
@@ -188,7 +184,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
 
        if (sound_feedback_item) {
                sound_feedback_item->userdata = ad;
-               __BACK_POINTER_SET(sound_feedback_item);
                SETTING_TRACE("Sound feedback Item added");
        }
 
@@ -200,10 +195,8 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
                                                                          {},
                                                                          NULL);
 
-       if (status_bar_information_item) {
+       if (status_bar_information_item)
                status_bar_information_item->userdata = ad;
-               __BACK_POINTER_SET(status_bar_information_item);
-       }
 
        multiline_status_bar_information_description = createGendialGroupItem(
                                genlist, &ad->itc_multiline_sub,
@@ -214,7 +207,6 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data)
 
        if (multiline_status_bar_information_description) {
                multiline_status_bar_information_description->userdata = ad;
-               __BACK_POINTER_SET(multiline_status_bar_information_description);
 
                elm_genlist_item_select_mode_set(
                        multiline_status_bar_information_description->item,
index b274a8d..3751098 100644 (file)
@@ -56,7 +56,6 @@ UniversalSwitchPage::UniversalSwitchPage(SettingAccessibility *ad)
        if (ad->universal_switch_off_checkbox) {
                ad->universal_switch_off_checkbox->userdata = ad;
                ad->universal_switch_off_checkbox->chk_status = state;
-               __BACK_POINTER_SET(ad->universal_switch_off_checkbox);
                elm_object_item_disabled_set(ad->universal_switch_off_checkbox->item, EINA_TRUE);
        }
 
@@ -69,7 +68,6 @@ UniversalSwitchPage::UniversalSwitchPage(SettingAccessibility *ad)
 
        if (ad->universal_switch_comment) {
                ad->universal_switch_comment->userdata = ad;
-               __BACK_POINTER_SET(ad->universal_switch_comment);
                elm_genlist_item_select_mode_set(ad->universal_switch_comment->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
        }
 
index bc62359..1406529 100644 (file)
@@ -296,7 +296,6 @@ static void _gl_Gendial_del(void *data, Evas_Object *obj)
                        item_data->notify = NULL;
                }
 
-               __BACK_POINTER_UNSET(item_data);
                delete item_data;
        }
 }
index 2e2fe58..7001c6b 100755 (executable)
 #define FREE(arg) __FREE(free, arg)
 #define G_FREE(arg) __FREE(g_free, arg)
 
-
-/*a trick:To manager back pointer. eg, */
-/*For using genlist, whenever Setting side and Genlist side both keep
- * pointers to a same block memory(here is genlis item data via calloc), must
- * use __BACK_POINTER_SET to bind the Setting side point into the Genlist side
- * pointer */
-#define __BACK_POINTER_SET(pData) do { \
-               if (pData) {\
-                       pData->pBack = (void **)(&(pData));\
-               } \
-       } while (0)
-
-#define __BACK_POINTER_UNSET(pData) do { \
-               /*release Setting side poniter handlers*/\
-               if (pData && pData->pBack) {\
-                       *(pData->pBack) = NULL;\
-               } \
-       } while (0)
-
 #endif /* _SETTING_DEBUG_H_ */