summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2016-04-10 18:53:29 +0300
committerYakov Goldberg <yakov.g@samsung.com>2016-04-13 17:10:46 +0300
commit7e7ec9e41e12fa41a6bbf64c11de9a3ad26a30ae (patch)
tree78e120417b28f08b3af4e3876400faa7f6738b8a
parenta72c3290f55687ccef6179c554f2179e5447595c (diff)
Fix memory leaks
-rw-r--r--src/bin/gui/cbview.c10
-rw-r--r--src/bin/gui/contentview.c1
-rw-r--r--src/bin/gui/descview.c1
-rw-r--r--src/bin/gui/dnd.h3
-rw-r--r--src/bin/gui/editor.c19
-rw-r--r--src/bin/gui/egui_logic.c2
-rw-r--r--src/bin/gui/itemview.c1
-rw-r--r--src/bin/gui/prop_layout.c3
-rw-r--r--src/bin/gui/settings.c2
-rw-r--r--src/bin/gui/simple_propview.c2
-rw-r--r--src/lib/desc_simple_parser.c1
-rw-r--r--src/lib/gui_parser.c3
-rw-r--r--src/lib/updater.c11
13 files changed, 40 insertions, 19 deletions
diff --git a/src/bin/gui/cbview.c b/src/bin/gui/cbview.c
index 621c142..683b67d 100644
--- a/src/bin/gui/cbview.c
+++ b/src/bin/gui/cbview.c
@@ -492,13 +492,6 @@ _item_del(void *data, Evas_Object *obj EINA_UNUSED)
492 _it_data_free(it_data); 492 _it_data_free(it_data);
493} 493}
494 494
495static Eina_Bool
496_wdgs_struct_free(void *wdgs, const Eo_Event *event EINA_UNUSED)
497{
498 free(wdgs);
499 return EINA_TRUE;
500}
501
502static Evas_Object * 495static Evas_Object *
503_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) 496_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
504{ 497{
@@ -520,7 +513,6 @@ _item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EIN
520 { 513 {
521 wdgs = egui_layout_cb_item_create(propview_table); 514 wdgs = egui_layout_cb_item_create(propview_table);
522 eo_key_data_set(wdgs->cb_item, "cb_item_wdgs", wdgs); 515 eo_key_data_set(wdgs->cb_item, "cb_item_wdgs", wdgs);
523 eo_event_callback_add(wdgs->cb_item, EO_BASE_EVENT_DEL, _wdgs_struct_free, wdgs);
524 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Create", NULL, ELM_ICON_NONE, NULL, NULL); 516 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Create", NULL, ELM_ICON_NONE, NULL, NULL);
525 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Modify", NULL, ELM_ICON_NONE, NULL, NULL); 517 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Modify", NULL, ELM_ICON_NONE, NULL, NULL);
526 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Invoke", NULL, ELM_ICON_NONE, NULL, NULL); 518 elm_hoversel_item_add(wdgs->cb_action_t_hsel, "Invoke", NULL, ELM_ICON_NONE, NULL, NULL);
@@ -647,6 +639,8 @@ cbview_build(const Gui_Widget *wdg)
647{ 639{
648 elm_obj_genlist_clear(cb_list); 640 elm_obj_genlist_clear(cb_list);
649 641
642 if (!wdg) return;
643
650 Eina_List *classes = eo_class_mro_get(wdg_class_name_get(wdg)); 644 Eina_List *classes = eo_class_mro_get(wdg_class_name_get(wdg));
651 const char *classname; 645 const char *classname;
652 Elm_Object_Item *glit = NULL; 646 Elm_Object_Item *glit = NULL;
diff --git a/src/bin/gui/contentview.c b/src/bin/gui/contentview.c
index 58e8eb5..efe7e6d 100644
--- a/src/bin/gui/contentview.c
+++ b/src/bin/gui/contentview.c
@@ -96,6 +96,7 @@ contentview_build(const Gui_Widget *wdg)
96 It_Data *it_data; 96 It_Data *it_data;
97 97
98 elm_obj_genlist_clear(ctn_list); 98 elm_obj_genlist_clear(ctn_list);
99 if (!wdg) return;
99 100
100 const char *wdg_name = wdg_obj_container_class_name_get(wdg); 101 const char *wdg_name = wdg_obj_container_class_name_get(wdg);
101 Eina_Bool isbox = (wdg_name && 102 Eina_Bool isbox = (wdg_name &&
diff --git a/src/bin/gui/descview.c b/src/bin/gui/descview.c
index ba33d28..ebf5160 100644
--- a/src/bin/gui/descview.c
+++ b/src/bin/gui/descview.c
@@ -19,6 +19,7 @@ void
19descview_build(const Gui_Widget *wdg) 19descview_build(const Gui_Widget *wdg)
20{ 20{
21 elm_obj_genlist_clear(desc_list); 21 elm_obj_genlist_clear(desc_list);
22 if (!wdg) return;
22 23
23 int i; 24 int i;
24 for (i = 0; descs[i]; i++) 25 for (i = 0; descs[i]; i++)
diff --git a/src/bin/gui/dnd.h b/src/bin/gui/dnd.h
index 884bb3e..3e04a3d 100644
--- a/src/bin/gui/dnd.h
+++ b/src/bin/gui/dnd.h
@@ -26,6 +26,9 @@ drop_item_container_del(Eo *obj);
26void 26void
27drag_item_container_set(Eo *obj, double anim_tm, double tm_to_drag, Elm_Drag_Start dragstart, Elm_Drag_Done dragdone); 27drag_item_container_set(Eo *obj, double anim_tm, double tm_to_drag, Elm_Drag_Start dragstart, Elm_Drag_Done dragdone);
28 28
29void
30drag_item_container_del(Eo *obj);
31
29const Gui_Widget * 32const Gui_Widget *
30dnd_drag_wdg_get(); 33dnd_drag_wdg_get();
31 34
diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c
index 93b0d83..7c9ee63 100644
--- a/src/bin/gui/editor.c
+++ b/src/bin/gui/editor.c
@@ -344,11 +344,12 @@ static void
344_wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility, int border_type_color) 344_wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility, int border_type_color)
345{ 345{
346 const Gui_Context *ctx = _active_context_get(); 346 const Gui_Context *ctx = _active_context_get();
347 if (!ctx) return;
348 const Gui_Session *session = gui_context_editor_session_get(ctx);
349 static Eo *_base_obj_prev = NULL;
350 Eo *obj = NULL; 347 Eo *obj = NULL;
351 Eo *base_obj = canvas_get(); 348 Eo *base_obj = canvas_get();
349
350 if (!ctx && !visibility) goto hide_borders;
351 const Gui_Session *session = gui_context_editor_session_get(ctx);
352 static Eo *_base_obj_prev = NULL;
352 if (wdg) 353 if (wdg)
353 { 354 {
354 if (IS_MAIN(wdg)) 355 if (IS_MAIN(wdg))
@@ -436,6 +437,7 @@ _wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility, int border_type_co
436 } 437 }
437 } 438 }
438 439
440hide_borders:
439 switch (border_type_color) 441 switch (border_type_color)
440 { 442 {
441 case BORDER_SELECTION: 443 case BORDER_SELECTION:
@@ -3395,6 +3397,7 @@ _editor_selected_wdg_del_cb()
3395 context_memento_finalize(ctx); 3397 context_memento_finalize(ctx);
3396} 3398}
3397 3399
3400static Ecore_Idler *_border_draw_idler = NULL;
3398void 3401void
3399editor_shutdown() 3402editor_shutdown()
3400{ 3403{
@@ -3402,12 +3405,19 @@ editor_shutdown()
3402 eo_key_data_del(g->main_win->canvas_scroller, EDITOR_DND_DATA); 3405 eo_key_data_del(g->main_win->canvas_scroller, EDITOR_DND_DATA);
3403 free(di); 3406 free(di);
3404 drop_target_wdg_del(NULL, g->main_win->canvas_scroller); 3407 drop_target_wdg_del(NULL, g->main_win->canvas_scroller);
3408 drop_item_container_del(g->main_win->objtree_list);
3409 drag_item_container_del(g->main_win->objtree_list);
3410
3411 ecore_idle_enterer_del(_border_draw_idler);
3412 _border_draw_idler = NULL;
3405 3413
3406 target_db_shutdown(); 3414 target_db_shutdown();
3407 proplayout_shutdown(); 3415 proplayout_shutdown();
3408 objtree_shutdown(); 3416 objtree_shutdown();
3409 autosave_shutdown(); 3417 autosave_shutdown();
3410 3418
3419 elm_obj_grid_clear(canvas_get(), EINA_TRUE);
3420
3411 void *p = (void *) propview_cbs_get(); 3421 void *p = (void *) propview_cbs_get();
3412 free(p); 3422 free(p);
3413 p = (void *) guilogic_cbs_get(); 3423 p = (void *) guilogic_cbs_get();
@@ -4470,6 +4480,7 @@ static void
4470_project_close(const Gui_Context *ctx) 4480_project_close(const Gui_Context *ctx)
4471{ 4481{
4472 /* Clear lists. */ 4482 /* Clear lists. */
4483 _editor_wdg_selected_set(NULL);
4473 objtree_context_set(NULL); 4484 objtree_context_set(NULL);
4474 proplayout_build(NULL); 4485 proplayout_build(NULL);
4475 if (ctx) 4486 if (ctx)
@@ -5027,7 +5038,7 @@ editor_init(GuiLogicCbs *_guilogic_cbs)
5027 proplayout_init(); 5038 proplayout_init();
5028 target_db_init(); 5039 target_db_init();
5029 autosave_init(); 5040 autosave_init();
5030 ecore_idle_enterer_add(_wdg_border_draw_on_idle, NULL); 5041 _border_draw_idler = ecore_idle_enterer_add(_wdg_border_draw_on_idle, NULL);
5031 5042
5032 DnD_Main_Obj_Info *di = calloc (1, sizeof(DnD_Main_Obj_Info)); 5043 DnD_Main_Obj_Info *di = calloc (1, sizeof(DnD_Main_Obj_Info));
5033 eo_key_data_set(g->main_win->canvas_scroller, EDITOR_DND_DATA, di); 5044 eo_key_data_set(g->main_win->canvas_scroller, EDITOR_DND_DATA, di);
diff --git a/src/bin/gui/egui_logic.c b/src/bin/gui/egui_logic.c
index d77e0c1..c94473e 100644
--- a/src/bin/gui/egui_logic.c
+++ b/src/bin/gui/egui_logic.c
@@ -363,9 +363,9 @@ project_open_create(const char *filename, int fs_mode, const char *dir, const ch
363 const char *title = "Warning"; 363 const char *title = "Warning";
364 const char *text = "Swap file exists for current project. Looks like file was not properly saved. Do you want to open swap file instead of original ?"; 364 const char *text = "Swap file exists for current project. Looks like file was not properly saved. Do you want to open swap file instead of original ?";
365 popup_show(g_main_wdgs->main_win->main_win, title, text, NULL, NULL, POPUP_OK_BUTTON | POPUP_CANCEL_BUTTON, _swapfile_popup_cb, strdup(filename)); 365 popup_show(g_main_wdgs->main_win->main_win, title, text, NULL, NULL, POPUP_OK_BUTTON | POPUP_CANCEL_BUTTON, _swapfile_popup_cb, strdup(filename));
366 free(swap_file);
367 ret = EINA_TRUE; 366 ret = EINA_TRUE;
368 } 367 }
368 free(swap_file);
369 if (ret) return; 369 if (ret) return;
370 _project_open_create_internal(filename, fs_mode, NULL, NULL, NULL); 370 _project_open_create_internal(filename, fs_mode, NULL, NULL, NULL);
371 } 371 }
diff --git a/src/bin/gui/itemview.c b/src/bin/gui/itemview.c
index dfaf61e..a730bb9 100644
--- a/src/bin/gui/itemview.c
+++ b/src/bin/gui/itemview.c
@@ -228,6 +228,7 @@ itemview_build(const Gui_Widget *wdg)
228#else 228#else
229 _witems_to_items_table = eina_hash_int32_new(NULL); 229 _witems_to_items_table = eina_hash_int32_new(NULL);
230#endif 230#endif
231 if (!wdg) return;
231 232
232 /* During first build, only headed widgets are added. */ 233 /* During first build, only headed widgets are added. */
233 const Item_Container_Item *root_it = wdg_item_container_root_get(wdg); 234 const Item_Container_Item *root_it = wdg_item_container_root_get(wdg);
diff --git a/src/bin/gui/prop_layout.c b/src/bin/gui/prop_layout.c
index 75348bb..dbcac97 100644
--- a/src/bin/gui/prop_layout.c
+++ b/src/bin/gui/prop_layout.c
@@ -215,7 +215,7 @@ proplayout_build(const Gui_Widget *wdg)
215{ 215{
216 It_Data_Type type = _new_type; 216 It_Data_Type type = _new_type;
217 217
218 if (!wdg) return; 218 //if (!wdg) return;
219 219
220 /* type ITEM_TYPE not assigned to any toolbar's item. 220 /* type ITEM_TYPE not assigned to any toolbar's item.
221 * It's assigned when toolbar's item is CONTENT and widget is menu. 221 * It's assigned when toolbar's item is CONTENT and widget is menu.
@@ -257,7 +257,6 @@ proplayout_build(const Gui_Widget *wdg)
257 } 257 }
258 case ITEM_TYPE: 258 case ITEM_TYPE:
259 { 259 {
260 itemview_clear();
261 itemview_build(wdg); 260 itemview_build(wdg);
262 break; 261 break;
263 } 262 }
diff --git a/src/bin/gui/settings.c b/src/bin/gui/settings.c
index b6d8bf6..2eef534 100644
--- a/src/bin/gui/settings.c
+++ b/src/bin/gui/settings.c
@@ -103,11 +103,13 @@ settings_load()
103 s = eina_json_string_get(v); 103 s = eina_json_string_get(v);
104 settings_custom_theme_add(s); 104 settings_custom_theme_add(s);
105 } 105 }
106 eina_iterator_free(it);
106 } 107 }
107 108
108end: 109end:
109 if (jv) eina_json_value_free(jv); 110 if (jv) eina_json_value_free(jv);
110 if (ctx) eina_json_context_free(ctx); 111 if (ctx) eina_json_context_free(ctx);
112 if (file_data) free(file_data);
111 return ret; 113 return ret;
112} 114}
113 115
diff --git a/src/bin/gui/simple_propview.c b/src/bin/gui/simple_propview.c
index 84be60b..8743a35 100644
--- a/src/bin/gui/simple_propview.c
+++ b/src/bin/gui/simple_propview.c
@@ -518,6 +518,8 @@ simple_propview_build(const Gui_Widget *wdg)
518 518
519 elm_obj_box_clear(_simple_properties_box); 519 elm_obj_box_clear(_simple_properties_box);
520 520
521 if (!wdg) return;
522
521 simple_op_desc_list = simple_op_desc_list_get(); 523 simple_op_desc_list = simple_op_desc_list_get();
522 EINA_LIST_FOREACH(simple_op_desc_list, itr1, simple_op_desc) 524 EINA_LIST_FOREACH(simple_op_desc_list, itr1, simple_op_desc)
523 { 525 {
diff --git a/src/lib/desc_simple_parser.c b/src/lib/desc_simple_parser.c
index 0e821e1..bfd4d1b 100644
--- a/src/lib/desc_simple_parser.c
+++ b/src/lib/desc_simple_parser.c
@@ -638,6 +638,7 @@ _parse_simple_op_desc(void)
638 sop = simple_op_desc_get(simple_op_name); 638 sop = simple_op_desc_get(simple_op_name);
639 simple_op_desc_section_name_set(sop, section_name); 639 simple_op_desc_section_name_set(sop, section_name);
640 DEBUG("Handling Simple Op %p (%s)\n", sop, simple_op_name); 640 DEBUG("Handling Simple Op %p (%s)\n", sop, simple_op_name);
641 free(section_name);
641 free(str); 642 free(str);
642 643
643 if (_next_keyword("as")) 644 if (_next_keyword("as"))
diff --git a/src/lib/gui_parser.c b/src/lib/gui_parser.c
index 20ef0cc..b1a8e8b 100644
--- a/src/lib/gui_parser.c
+++ b/src/lib/gui_parser.c
@@ -558,6 +558,7 @@ _widget_parse(Gui_Context *gui_ctx, Eid *eid, Eina_Json_Value *widget_js, Eina_B
558 { 558 {
559 ERR("Cannot find op description: \"%s\" for class: \"%s\"\n" 559 ERR("Cannot find op description: \"%s\" for class: \"%s\"\n"
560 "Property will not take effect.", prop_name, class_name); 560 "Property will not take effect.", prop_name, class_name);
561 free(prop_name_tmp);
561 continue; 562 continue;
562 } 563 }
563 Gui_Widget_Property *prop = prop_create_for_op(op); 564 Gui_Widget_Property *prop = prop_create_for_op(op);
@@ -570,6 +571,7 @@ _widget_parse(Gui_Context *gui_ctx, Eid *eid, Eina_Json_Value *widget_js, Eina_B
570 { 571 {
571 ERR("Parsing error! Widget: \"%s\", property: \"%s\". Param count: %d, should be: %d.", 572 ERR("Parsing error! Widget: \"%s\", property: \"%s\". Param count: %d, should be: %d.",
572 widget_name, prop_name, json_arr_param_count, db_param_count); 573 widget_name, prop_name, json_arr_param_count, db_param_count);
574 free(prop_name_tmp);
573 goto bad_end; 575 goto bad_end;
574 } 576 }
575 577
@@ -1005,6 +1007,7 @@ _settings_parse(Gui_Context *gui_ctx, Eina_Json_Value *res_js)
1005 gui_context_project_path_get(gui_ctx), val); 1007 gui_context_project_path_get(gui_ctx), val);
1006 basedir_abs = eina_file_path_sanitize(basedir_rel); 1008 basedir_abs = eina_file_path_sanitize(basedir_rel);
1007 gui_context_project_basedir_abs_set(gui_ctx, basedir_abs); 1009 gui_context_project_basedir_abs_set(gui_ctx, basedir_abs);
1010 free(basedir_abs);
1008 } 1011 }
1009 ret = EINA_TRUE; 1012 ret = EINA_TRUE;
1010 return ret; 1013 return ret;
diff --git a/src/lib/updater.c b/src/lib/updater.c
index 714dea7..ce446cb 100644
--- a/src/lib/updater.c
+++ b/src/lib/updater.c
@@ -112,9 +112,12 @@ _eo_add_apply(const Eina_List *sessions, Eid *eid)
112 { 112 {
113 if (session_eo_get(s, wdg)) continue; 113 if (session_eo_get(s, wdg)) continue;
114 manager_widget_create(s, wdg, NULL); 114 manager_widget_create(s, wdg, NULL);
115 _resize_cb_added = EINA_TRUE; 115 if (!IS_MAIN(wdg))
116 _resize_cb_called = EINA_FALSE; 116 {
117 eo_event_callback_add(session_eo_get(s, wdg), EVAS_OBJECT_EVENT_RESIZE, _resized_cb, NULL); 117 _resize_cb_added = EINA_TRUE;
118 _resize_cb_called = EINA_FALSE;
119 eo_event_callback_add(session_eo_get(s, wdg), EVAS_OBJECT_EVENT_RESIZE, _resized_cb, NULL);
120 }
118 } 121 }
119} 122}
120 123
@@ -334,7 +337,7 @@ _update_check(void *data EINA_UNUSED)
334 } 337 }
335 else 338 else
336 { 339 {
337 if (!_resize_cb_added || (_resize_cb_added && _resize_cb_called) ) 340 if (!_resize_cb_added || (_resize_cb_added && _resize_cb_called))
338 { 341 {
339 Eina_List *itr2; 342 Eina_List *itr2;
340 Completion_Info *info; 343 Completion_Info *info;