From 2ba50536071623872344a44b4246b88af4a8583a Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Fri, 19 Jun 2015 16:09:12 +0200 Subject: hack around filelist return segfaulting. Signed-off-by: Olliver Schinagl --- src/eulogium_item_list.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/eulogium_item_list.c b/src/eulogium_item_list.c index 98cb461..2cf62a1 100644 --- a/src/eulogium_item_list.c +++ b/src/eulogium_item_list.c @@ -43,7 +43,7 @@ static Evas_Object *_item_new(Evas_Object *parent, Evas_Object *icon, char const { Evas_Object *it; const char *cb = "changed"; - struct list_item dummy = {.type = LIST_ITEM_BUTTON}; + struct list_item dummy = {.type = LIST_ITEM_BUTTON, ._widget = NULL}; if (!item) /* If no button type is passed (file-list for ex.) use the default 'button' entry */ item = &dummy; @@ -57,6 +57,16 @@ static Evas_Object *_item_new(Evas_Object *parent, Evas_Object *icon, char const it = elm_check_add(parent); elm_check_state_pointer_set(it, &item->state); /* elm_object_style_set(it, "list"); */ + /* XXX FIXME: this is a hack. PRINT -> Return -> Segfault. + * When we return to the from the file list in the PRINT menu, we segfault. + * Technically we don't want to store the pointer to the widget for anything + * but checkboxes and radio buttons, but a generic callback at the bottom for + * all cases was nicer. Since we don't have radio buttons yet we can leave + * this here for now. + */ + evas_object_event_callback_add(it, EVAS_CALLBACK_DEL, _item_destroy_cb, &item->_widget); + if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) + EINA_LOG_CRIT("Callback registering failed! Problems ensured!\n"); break; case LIST_ITEM_BUTTON: cb = "clicked"; @@ -78,9 +88,6 @@ static Evas_Object *_item_new(Evas_Object *parent, Evas_Object *icon, char const evas_object_size_hint_align_set(it, EVAS_HINT_FILL, 0); evas_object_show(it); item->_widget = it; - evas_object_event_callback_add(it, EVAS_CALLBACK_DEL, _item_destroy_cb, &item->_widget); - if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) - EINA_LOG_CRIT("Callback registering failed! Problems ensured!\n"); return it; } -- cgit v0.12