summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-05-21 14:42:29 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-05-21 15:49:24 +0300
commit972acbd6aba020a34a2f7a1fa41619d8b075c136 (patch)
tree0d89c5e851f3f34eabfafe1bfbb06f46a673d396
parente5e226887062ace9ee6800feca77d656432784f2 (diff)
fix error with empty callback
-rw-r--r--src/bin/egui_gui/propview.c11
-rw-r--r--src/lib/ffi_glue.c9
-rw-r--r--src/lib/generator.c9
3 files changed, 15 insertions, 14 deletions
diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c
index 03b3421..9b53d6c 100644
--- a/src/bin/egui_gui/propview.c
+++ b/src/bin/egui_gui/propview.c
@@ -203,7 +203,7 @@ _cb_add(void *data, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
203} 203}
204 204
205static void 205static void
206_cb_del(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) 206_cb_del(void *data, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
207{ 207{
208 Gui_Widget_Callback *cb = data; 208 Gui_Widget_Callback *cb = data;
209 Gui_Widget *wdg = cb_wdg_get(cb); 209 Gui_Widget *wdg = cb_wdg_get(cb);
@@ -549,15 +549,6 @@ _callbacks_build(const Gui_Widget *wdg)
549 Gui_Widget_Callback *cb = NULL; 549 Gui_Widget_Callback *cb = NULL;
550 EINA_LIST_FOREACH_SAFE(cbs_list, itr, itr2, cb) 550 EINA_LIST_FOREACH_SAFE(cbs_list, itr, itr2, cb)
551 { 551 {
552 Dep_Id dep_id = cb_sequence_id_get(cb);
553 /* Check id of callback, and if it not already exists.
554 * (sequence was deleted), delete this callback. */
555 if (!gui_context_dep_exists(_active_context_get(), dep_id))
556 {
557 wdg_cb_del(cb_wdg_get(cb), cb);
558 cb_del(cb);
559 continue;
560 }
561 It_Data *it_data = IT_DATA_BUILD(CALLBACK_TYPE, wdg); 552 It_Data *it_data = IT_DATA_BUILD(CALLBACK_TYPE, wdg);
562 it_data->cb = cb; 553 it_data->cb = cb;
563 it_box = _item_content_get(it_data); 554 it_box = _item_content_get(it_data);
diff --git a/src/lib/ffi_glue.c b/src/lib/ffi_glue.c
index 21f8c6d..fbee193 100644
--- a/src/lib/ffi_glue.c
+++ b/src/lib/ffi_glue.c
@@ -87,6 +87,15 @@ manager_widget_property_add(Gui_Session *session, const Gui_Widget *wdg, const G
87Eina_Bool 87Eina_Bool
88manager_widget_callback_add(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_Callback *cb, Action_Mode mode, void *data) 88manager_widget_callback_add(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_Callback *cb, Action_Mode mode, void *data)
89{ 89{
90 const Gui_Context *ctx = wdg_context_get(wdg);
91 const char *cb_type = cb_type_get(cb);
92 Dep_Id name_id = cb_sequence_id_get(cb);
93
94 if ((!cb_type) || (!gui_context_dep_exists(ctx, name_id)))
95 {
96 return EINA_FALSE;
97 }
98
90 if (_modes_functions[mode].cb_add) 99 if (_modes_functions[mode].cb_add)
91 { 100 {
92 Eina_Bool ret; 101 Eina_Bool ret;
diff --git a/src/lib/generator.c b/src/lib/generator.c
index 587f91e..64fb39e 100644
--- a/src/lib/generator.c
+++ b/src/lib/generator.c
@@ -546,9 +546,9 @@ _wdg_cb_add_generate(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widg
546 const char *cb_type = cb_type_get(cb); 546 const char *cb_type = cb_type_get(cb);
547 Dep_Id dep_id = cb_sequence_id_get(cb); 547 Dep_Id dep_id = cb_sequence_id_get(cb);
548 548
549 if (!gui_context_dep_exists(ctx, dep_id)) 549 if ((!cb_type) || (!gui_context_dep_exists(ctx, dep_id)))
550 { 550 {
551 ERR("Widget: \"%s\", resource for callback type: \"%s\" was deleted", wdg_name_get(wdg), cb_type); 551 ERR("This shouldn't happen here, check cb_add in ffi_glue");
552 return ret; 552 return ret;
553 } 553 }
554 Gui_Sequence *seq = sequence_get(wdg_context_get(wdg), dep_id); 554 Gui_Sequence *seq = sequence_get(wdg_context_get(wdg), dep_id);
@@ -995,13 +995,14 @@ _wdg_to_json_str_get(Gui_Widget *wdg)
995 { 995 {
996 const char *cb_type = cb_type_get(cb); 996 const char *cb_type = cb_type_get(cb);
997 Dep_Id dep_id = cb_sequence_id_get(cb); 997 Dep_Id dep_id = cb_sequence_id_get(cb);
998 if (gui_context_dep_exists(wdg_context_get(wdg), dep_id)) 998 if ((cb_type) && (gui_context_dep_exists(wdg_context_get(wdg), dep_id)))
999 { 999 {
1000 const char *seq_name = gui_context_dep_data_get(wdg_context_get(wdg), dep_id); 1000 const char *seq_name = gui_context_dep_data_get(wdg_context_get(wdg), dep_id);
1001 eina_json_object_append(jsnval, cb_type, eina_json_string_new(seq_name)); 1001 eina_json_object_append(jsnval, cb_type, eina_json_string_new(seq_name));
1002 } 1002 }
1003 } 1003 }
1004 eina_json_object_append(root_obj, "Callbacks", jsnval); 1004 if (eina_json_object_count_get(jsnval))
1005 eina_json_object_append(root_obj, "Callbacks", jsnval);
1005 } 1006 }
1006 1007
1007 if (IS_CONTAINER(wdg)) 1008 if (IS_CONTAINER(wdg))