diff options
author | David Walter Seikel | 2014-05-20 18:25:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-20 18:25:58 +1000 |
commit | 315aaabbce6b2db52ff5796708b777b488fd848e (patch) | |
tree | b58c92292cda35e4435b2448d61a654e30580c7d | |
parent | Clean up the server startup and connection a bit. (diff) | |
download | SledjHamr-315aaabbce6b2db52ff5796708b777b488fd848e.zip SledjHamr-315aaabbce6b2db52ff5796708b777b488fd848e.tar.gz SledjHamr-315aaabbce6b2db52ff5796708b777b488fd848e.tar.bz2 SledjHamr-315aaabbce6b2db52ff5796708b777b488fd848e.tar.xz |
The results of a session with valgrind.
I'm surprised that this highly experimental code, built with chewing gum and chicken wire,
had so little problems, and most of those where leaks. The majority of problems reported
are from external libraries.
Diffstat (limited to '')
-rw-r--r-- | src/GuiLua/GuiLua.c | 5 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 3 | ||||
-rw-r--r-- | src/extantz/Evas_3D_demo.c | 1 | ||||
-rw-r--r-- | src/extantz/camera.c | 1 | ||||
-rw-r--r-- | src/extantz/ephysics_demo.c | 5 | ||||
-rw-r--r-- | src/extantz/extantz.c | 6 | ||||
-rw-r--r-- | src/extantz/extantz.h | 1 | ||||
-rw-r--r-- | src/extantz/scenri.c | 17 | ||||
-rw-r--r-- | src/extantz/woMan.c | 2 | ||||
-rw-r--r-- | src/libraries/Runnr.c | 22 | ||||
-rw-r--r-- | src/libraries/SledjHamr.c | 3 | ||||
-rw-r--r-- | src/libraries/winFang.c | 15 | ||||
-rw-r--r-- | src/love/love.c | 11 |
13 files changed, 66 insertions, 26 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 2fa9bcb..5815b45 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -204,6 +204,7 @@ static int action(lua_State *L) | |||
204 | if (wid && strcmp(wid->magic, "Widget") == 0) | 204 | if (wid && strcmp(wid->magic, "Widget") == 0) |
205 | { | 205 | { |
206 | //PD("Setting action : %s\n", action); | 206 | //PD("Setting action : %s\n", action); |
207 | free(wid->action); | ||
207 | wid->action = strdup(action); | 208 | wid->action = strdup(action); |
208 | } | 209 | } |
209 | return 0; | 210 | return 0; |
@@ -302,7 +303,7 @@ static int window(lua_State *L) | |||
302 | } | 303 | } |
303 | 304 | ||
304 | win = winFangAdd(parent, 5, 26, w, h, title, name, world); | 305 | win = winFangAdd(parent, 5, 26, w, h, title, name, world); |
305 | win->module = module; | 306 | win->module = strdup(module); |
306 | if (gl) | 307 | if (gl) |
307 | { | 308 | { |
308 | // If there's no parent, we become the parent. | 309 | // If there's no parent, we become the parent. |
@@ -418,7 +419,7 @@ PD("GuiLua 3"); | |||
418 | 419 | ||
419 | push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0); | 420 | push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0); |
420 | push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "quit", "Quit, exit, remove thyself.", quit, 0); | 421 | push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "quit", "Quit, exit, remove thyself.", quit, 0); |
421 | push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "closeWindow", "Closes a window.", closeWindow, "userdata", 0); // TODO - closeWindow, "userdata"); | 422 | push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "closeWindow", "Closes a window.", closeWindow, "userdata", 0); |
422 | 423 | ||
423 | // A test of the array building stuff. | 424 | // A test of the array building stuff. |
424 | push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, skang, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); | 425 | push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, skang, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); |
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index c6ac70a..4fe5671 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c | |||
@@ -985,6 +985,7 @@ LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *state, LSL_Leaf *identifi | |||
985 | { | 985 | { |
986 | func->state = result->name.text; | 986 | func->state = result->name.text; |
987 | } | 987 | } |
988 | eina_iterator_free(handlers); | ||
988 | result->block = block->value.blockValue; | 989 | result->block = block->value.blockValue; |
989 | if (state) | 990 | if (state) |
990 | { | 991 | { |
@@ -1541,7 +1542,7 @@ static void outputRawParenthesisToken(FILE *file, outputMode mode, LSL_Parenthes | |||
1541 | else | 1542 | else |
1542 | outputLeaf(file, mode, parenthesis->contents); | 1543 | outputLeaf(file, mode, parenthesis->contents); |
1543 | if ((OM_LUA == mode) && (MF_WRAPFUNC & parenthesis->flags)) | 1544 | if ((OM_LUA == mode) && (MF_WRAPFUNC & parenthesis->flags)) |
1544 | // TODO - Need to fetc the identifier before, but we only have one in my test code, so fake it. | 1545 | // TODO - Need to fetch the identifier before, but we only have one in my test code, so fake it. |
1545 | fprintf(file, "; return ix; end)() "); | 1546 | fprintf(file, "; return ix; end)() "); |
1546 | else | 1547 | else |
1547 | { | 1548 | { |
diff --git a/src/extantz/Evas_3D_demo.c b/src/extantz/Evas_3D_demo.c index fb6f03f..3dda9ef 100644 --- a/src/extantz/Evas_3D_demo.c +++ b/src/extantz/Evas_3D_demo.c | |||
@@ -456,7 +456,6 @@ void Evas_3D_Demo_add(globals *ourGlobals) | |||
456 | 456 | ||
457 | void Evas_3D_Demo_fini(globals *ourGlobals) | 457 | void Evas_3D_Demo_fini(globals *ourGlobals) |
458 | { | 458 | { |
459 | eo_unref(ourGlobals->scene->image); | ||
460 | free(sphere_vertices); | 459 | free(sphere_vertices); |
461 | free(sphere_indices); | 460 | free(sphere_indices); |
462 | } | 461 | } |
diff --git a/src/extantz/camera.c b/src/extantz/camera.c index 83bf98a..b7a79d1 100644 --- a/src/extantz/camera.c +++ b/src/extantz/camera.c | |||
@@ -235,6 +235,7 @@ Evas_3D_Node *cameraAdd(Evas *evas, Scene_Data *scene, Evas_Object *image) | |||
235 | // evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 20.0, EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0) | 235 | // evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 20.0, EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0) |
236 | evas_3d_node_orientation_set(0.0, 0.0, 0.0, 1.0) | 236 | evas_3d_node_orientation_set(0.0, 0.0, 0.0, 1.0) |
237 | ); | 237 | ); |
238 | // eo_unref(camera); | ||
238 | 239 | ||
239 | eo_do(scene->root_node, evas_3d_node_member_add(result)); | 240 | eo_do(scene->root_node, evas_3d_node_member_add(result)); |
240 | eo_do(scene->scene, evas_3d_scene_camera_node_set(result)); | 241 | eo_do(scene->scene, evas_3d_scene_camera_node_set(result)); |
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c index 6ace8a0..a0bf4d0 100644 --- a/src/extantz/ephysics_demo.c +++ b/src/extantz/ephysics_demo.c | |||
@@ -34,7 +34,7 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals) | |||
34 | 34 | ||
35 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); | 35 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); |
36 | box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, | 36 | box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, |
37 | elm_obj_image_file_set(strdup(buf), "blue-cube"), | 37 | elm_obj_image_file_set(buf, "blue-cube"), |
38 | evas_obj_size_set(70, 70), | 38 | evas_obj_size_set(70, 70), |
39 | evas_obj_position_set(ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200), | 39 | evas_obj_position_set(ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200), |
40 | evas_obj_visibility_set(EINA_TRUE) | 40 | evas_obj_visibility_set(EINA_TRUE) |
@@ -49,10 +49,9 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals) | |||
49 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); | 49 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); |
50 | eo_unref(box1); | 50 | eo_unref(box1); |
51 | 51 | ||
52 | |||
53 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); | 52 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); |
54 | box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, | 53 | box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, |
55 | elm_obj_image_file_set(strdup(buf), "purple-cube"), | 54 | elm_obj_image_file_set(buf, "purple-cube"), |
56 | evas_obj_size_set(70, 70), | 55 | evas_obj_size_set(70, 70), |
57 | evas_obj_position_set(ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200), | 56 | evas_obj_position_set(ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200), |
58 | evas_obj_visibility_set(EINA_TRUE) | 57 | evas_obj_visibility_set(EINA_TRUE) |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index ff418c0..fa38251 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -606,8 +606,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
606 | ourGlobals.ee = ecore_evas_ecore_evas_get(ourGlobals.evas); // Only use this on Evas that was created with Ecore_Evas. | 606 | ourGlobals.ee = ecore_evas_ecore_evas_get(ourGlobals.evas); // Only use this on Evas that was created with Ecore_Evas. |
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); | ||
610 | |||
611 | // Get the screen size. | 609 | // Get the screen size. |
612 | elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); | 610 | elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); |
613 | ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); | 611 | ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); |
@@ -616,6 +614,8 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
616 | evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y); | 614 | evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y); |
617 | evas_object_resize(ourGlobals.win, ourGlobals.win_w, ourGlobals.win_h); | 615 | evas_object_resize(ourGlobals.win, ourGlobals.win_w, ourGlobals.win_h); |
618 | 616 | ||
617 | evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); | ||
618 | |||
619 | /* Our "layers". TODO - This is out of date, I should update it. | 619 | /* Our "layers". TODO - This is out of date, I should update it. |
620 | 620 | ||
621 | Elm win - our real main window | 621 | Elm win - our real main window |
@@ -694,7 +694,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
694 | 694 | ||
695 | if (ourGlobals.win) | 695 | if (ourGlobals.win) |
696 | { | 696 | { |
697 | ecore_animator_del(ourGlobals.animator); | ||
697 | Evas_3D_Demo_fini(&ourGlobals); | 698 | Evas_3D_Demo_fini(&ourGlobals); |
699 | scenriDel(ourGlobals.scene); | ||
698 | eo_unref(ourGlobals.tb); | 700 | eo_unref(ourGlobals.tb); |
699 | winFangDel(ourGlobals.mainWindow); | 701 | winFangDel(ourGlobals.mainWindow); |
700 | } | 702 | } |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index d77c764..a41f4e0 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -264,6 +264,7 @@ void Evas_3D_Demo_fini(globals *ourGlobals); | |||
264 | Scene_Data *scenriAdd(Evas_Object *win); | 264 | Scene_Data *scenriAdd(Evas_Object *win); |
265 | Evas_3D_Node *cameraAdd(Evas *evas, Scene_Data *scene, Evas_Object *win); | 265 | Evas_3D_Node *cameraAdd(Evas *evas, Scene_Data *scene, Evas_Object *win); |
266 | Eina_Bool animateCamera(Scene_Data *scene); | 266 | Eina_Bool animateCamera(Scene_Data *scene); |
267 | void scenriDel(Scene_Data *scene); | ||
267 | 268 | ||
268 | winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); | 269 | winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); |
269 | void filesShow(winFang *me, Evas_Smart_Cb func, void *data); | 270 | void filesShow(winFang *me, Evas_Smart_Cb func, void *data); |
diff --git a/src/extantz/scenri.c b/src/extantz/scenri.c index eaec88e..0210a48 100644 --- a/src/extantz/scenri.c +++ b/src/extantz/scenri.c | |||
@@ -143,7 +143,20 @@ Scene_Data *scenriAdd(Evas_Object *win) | |||
143 | return scene; | 143 | return scene; |
144 | } | 144 | } |
145 | 145 | ||
146 | void scenriDel(globals *ourGlobals) | 146 | void scenriDel(Scene_Data *scene) |
147 | { | 147 | { |
148 | eo_unref(ourGlobals->scene->image); | 148 | // TODO - I should probably free up all this Evas_3D stuff. Oddly Eo doesn't bitch about it, only valgrind. |
149 | // Eo bitches if they are unref'd here. | ||
150 | // So either Eo or valgrind bitches, depending on what I do. I'll leave them commented out, let valgrind bitch, and blame Evas_3D. | ||
151 | // eo_unref(scene->light_node); | ||
152 | // eo_unref(scene->light); | ||
153 | |||
154 | // TODO - Should have a separate cameraDel() for these. | ||
155 | free(scene->move); | ||
156 | // eo_unref(scene->camera_node); | ||
157 | |||
158 | eo_unref(scene->image); | ||
159 | eo_unref(scene->scene); | ||
160 | // eo_unref(scene->root_node); | ||
161 | free(scene); | ||
149 | } | 162 | } |
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index 64df84c..ef10631 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -245,6 +245,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
245 | viewer_gic->func.del = NULL; | 245 | viewer_gic->func.del = NULL; |
246 | for (i = 0; NULL != viewerTest[i][0]; i++) | 246 | for (i = 0; NULL != viewerTest[i][0]; i++) |
247 | { | 247 | { |
248 | // TODO - Should free this later, but this entire thing needs a rewrite anyway. | ||
248 | ezViewer *thisViewer = calloc(1, sizeof(ezViewer)); | 249 | ezViewer *thisViewer = calloc(1, sizeof(ezViewer)); |
249 | 250 | ||
250 | if (thisViewer) | 251 | if (thisViewer) |
@@ -265,6 +266,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
265 | 266 | ||
266 | sprintf(buf, "%s/%s", elm_app_data_dir_get(), img3); | 267 | sprintf(buf, "%s/%s", elm_app_data_dir_get(), img3); |
267 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); | 268 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); |
269 | // TODO - This strdup leaks, but this is just temporary test code anyway, it will go away. | ||
268 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); | 270 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); |
269 | tab = gridList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); | 271 | tab = gridList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it); |
270 | elm_layout_box_append(me->win, WF_BOX, nf); | 272 | elm_layout_box_append(me->win, WF_BOX, nf); |
diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c index b775e19..72bc523 100644 --- a/src/libraries/Runnr.c +++ b/src/libraries/Runnr.c | |||
@@ -151,6 +151,9 @@ static char *_push_name(lua_State *L, char *q, int *idx) // Stack usage [-0, +1 | |||
151 | return q; | 151 | return q; |
152 | } | 152 | } |
153 | 153 | ||
154 | /* It's the callers job to stash things safely before returning from the Lua to C function call. | ||
155 | * Coz things like strings might go away after the stack is freed. | ||
156 | */ | ||
154 | int pull_lua(lua_State *L, int i, char *params, ...) // Stack usage - | 157 | int pull_lua(lua_State *L, int i, char *params, ...) // Stack usage - |
155 | // if i is a table | 158 | // if i is a table |
156 | // [-n, +n, e] | 159 | // [-n, +n, e] |
@@ -210,16 +213,15 @@ int pull_lua(lua_State *L, int i, char *params, ...) // Stack usage - | |||
210 | if (lua_isstring(L, j)) // Stack usage [-0, +0, -] | 213 | if (lua_isstring(L, j)) // Stack usage [-0, +0, -] |
211 | { | 214 | { |
212 | char **v = va_arg(vl, char **); | 215 | char **v = va_arg(vl, char **); |
213 | size_t len; | 216 | |
214 | char *temp = (char *) lua_tolstring(L, j, &len); // Stack usage [-0, +0, m] | 217 | // We could strdup the string, but that causes leaks. |
215 | 218 | // The problem is that the caller doesn't know if we allocated or not, | |
216 | len++; // Cater for the null at the end. | 219 | // since the incoming pointer could already be pointing to a default value. |
217 | *v = malloc(len); | 220 | // Lua says the string is valid until it's popped off the stack, |
218 | if (*v) | 221 | // and this is used only in calls to C functions from Lua. |
219 | { | 222 | // So just document that it's the callers job to stash it safely if needed after returning. |
220 | memcpy(*v, temp, len); | 223 | *v = (char *) lua_tostring(L, j); |
221 | n++; | 224 | n++; |
222 | } | ||
223 | } | 225 | } |
224 | break; | 226 | break; |
225 | } | 227 | } |
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index 7fcede7..5f26fde 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c | |||
@@ -47,6 +47,9 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | if (ev->server) ecore_con_server_del(ev->server); | 49 | if (ev->server) ecore_con_server_del(ev->server); |
50 | // TODO - Hmm, I think this is where this should be freed, but it causes a seggie in reachOut's while loop. | ||
51 | // Which is odd, so leave it commented for now and investigate later. | ||
52 | // free(this); | ||
50 | 53 | ||
51 | return ECORE_CALLBACK_CANCEL; | 54 | return ECORE_CALLBACK_CANCEL; |
52 | } | 55 | } |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index b6ceee9..bfd9327 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -369,28 +369,29 @@ void winFangCalcMinSize(winFang *win) | |||
369 | 369 | ||
370 | void winFangDel(winFang *win) | 370 | void winFangDel(winFang *win) |
371 | { | 371 | { |
372 | winFang *wf; | 372 | winFang *wf, *wf2; |
373 | Widget *wid; | 373 | Widget *wid, *wid2; |
374 | 374 | ||
375 | if (!win) return; | 375 | if (!win) return; |
376 | 376 | ||
377 | if (win->bg) eo_unref(win->bg); | 377 | if (win->bg) eo_unref(win->bg); |
378 | if (win->grid) eo_unref(win->grid); | 378 | if (win->grid) eo_unref(win->grid); |
379 | if (win->layout) eo_unref(win->layout); | 379 | if (win->layout) eo_unref(win->layout); |
380 | EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) | 380 | EINA_CLIST_FOR_EACH_ENTRY_SAFE(wf, wf2, &win->winFangs, winFang, node) |
381 | { | 381 | { |
382 | winFangDel(wf); | 382 | winFangDel(wf); |
383 | } | 383 | } |
384 | 384 | ||
385 | // Elm will delete our widgets, but if we are using eo, we need to unref them. | 385 | // Elm will delete our widgets, but if we are using eo, we need to unref them. |
386 | EINA_CLIST_FOR_EACH_ENTRY(wid, &win->widgets, Widget, node) | 386 | EINA_CLIST_FOR_EACH_ENTRY_SAFE(wid, wid2, &win->widgets, Widget, node) |
387 | { | 387 | { |
388 | if (wid->on_del) wid->on_del(wid, wid->obj, NULL); | 388 | if (wid->on_del) wid->on_del(wid, wid->obj, NULL); |
389 | widgetDel(wid); | 389 | widgetDel(wid); |
390 | eo_unref(wid->obj); | ||
391 | } | 390 | } |
392 | if (win->on_del) win->on_del(win, win->win, NULL); | 391 | if (win->on_del) win->on_del(win, win->win, NULL); |
393 | evas_object_del(win->win); | 392 | evas_object_del(win->win); |
393 | free(win->module); | ||
394 | free(win); | ||
394 | } | 395 | } |
395 | 396 | ||
396 | 397 | ||
@@ -483,10 +484,14 @@ void widgetDel(Widget *wid) | |||
483 | { | 484 | { |
484 | if (wid) | 485 | if (wid) |
485 | { | 486 | { |
487 | free(wid->action); | ||
488 | free(wid->label); | ||
486 | // TODO - This is to work around a bug in Elm entry, remove it when the bug is fixed. | 489 | // TODO - This is to work around a bug in Elm entry, remove it when the bug is fixed. |
487 | // The bug is that editable entry widgets cause the app to hang on exit. | 490 | // The bug is that editable entry widgets cause the app to hang on exit. |
488 | if (strcmp(WT_ENTRY, wid->type) == 0) | 491 | if (strcmp(WT_ENTRY, wid->type) == 0) |
489 | elm_entry_editable_set(wid->obj, EINA_FALSE); | 492 | elm_entry_editable_set(wid->obj, EINA_FALSE); |
493 | eo_unref(wid->obj); | ||
494 | free(wid); | ||
490 | } | 495 | } |
491 | } | 496 | } |
492 | 497 | ||
diff --git a/src/love/love.c b/src/love/love.c index 91c9d95..0e4ac40 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -142,6 +142,9 @@ static void dirList_compile(const char *name, const char *path, void *data) | |||
142 | { | 142 | { |
143 | if (0 == strcmp(ext, ".lsl")) | 143 | if (0 == strcmp(ext, ".lsl")) |
144 | { | 144 | { |
145 | // TODO - We are leaking these, coz we don't know when scripts get deleted in the script server. | ||
146 | // On the other hand, the main use for this is a temporary hack that sends events to all scripts. | ||
147 | // So that part will get a rewrite when we make it real later anyway. | ||
145 | script *me = calloc(1, sizeof(script)); | 148 | script *me = calloc(1, sizeof(script)); |
146 | 149 | ||
147 | scriptCount++; | 150 | scriptCount++; |
@@ -388,6 +391,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e | |||
388 | { | 391 | { |
389 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.link_message%s", &command[15]); | 392 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.link_message%s", &command[15]); |
390 | } | 393 | } |
394 | eina_iterator_free(scripts); | ||
391 | } | 395 | } |
392 | else if (0 == strncmp(command, "llGetNotecardLine(", 18)) | 396 | else if (0 == strncmp(command, "llGetNotecardLine(", 18)) |
393 | { | 397 | { |
@@ -421,6 +425,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e | |||
421 | temp = NULL; | 425 | temp = NULL; |
422 | do | 426 | do |
423 | { | 427 | { |
428 | free(temp); | ||
424 | temp = get_rawline(fd, &len, '\n'); | 429 | temp = get_rawline(fd, &len, '\n'); |
425 | if (temp) | 430 | if (temp) |
426 | { | 431 | { |
@@ -455,6 +460,8 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e | |||
455 | else | 460 | else |
456 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); | 461 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.dataserver(\"%s\", \"EndOfFuckingAround\")", key); |
457 | } | 462 | } |
463 | eina_iterator_free(scripts); | ||
464 | free(temp); | ||
458 | 465 | ||
459 | close(fd); | 466 | close(fd); |
460 | } | 467 | } |
@@ -545,6 +552,7 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data * | |||
545 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); | 552 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); |
546 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); | 553 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); |
547 | } | 554 | } |
555 | eina_iterator_free(scripts); | ||
548 | } | 556 | } |
549 | else if (0 == strncmp(command, "events.listen(", 14)) | 557 | else if (0 == strncmp(command, "events.listen(", 14)) |
550 | { | 558 | { |
@@ -557,6 +565,7 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data * | |||
557 | { | 565 | { |
558 | sendForth(ourGlobals->serverLuaSL, me->SID, command); | 566 | sendForth(ourGlobals->serverLuaSL, me->SID, command); |
559 | } | 567 | } |
568 | eina_iterator_free(scripts); | ||
560 | } | 569 | } |
561 | else | 570 | else |
562 | PW("Unknown command from client - %s", command); | 571 | PW("Unknown command from client - %s", command); |
@@ -768,6 +777,8 @@ int main(int argc, char **argv) | |||
768 | } | 777 | } |
769 | else | 778 | else |
770 | PC("Failed to init ecore_con!"); | 779 | PC("Failed to init ecore_con!"); |
780 | |||
781 | eina_hash_free(ourGlobals.scripts); | ||
771 | } | 782 | } |
772 | else | 783 | else |
773 | fprintf(stderr, "Failed to init eina!"); | 784 | fprintf(stderr, "Failed to init eina!"); |