Unfortunately, this bug is still valid.
Applications using lua crash, if it creates(/deletes) sufficient elements.
See https://phab.enlightenment.org/T323 for an example that will crash
e.g. edje_player if the window is resized a couple of times.

Could you have another look? I guess that increasing the number of
rects should crash the applications right on startup.

Regards,

Leif

2013/5/22 David Walter Seikel - Enlightenment Git <no-re...@enlightenment.org>:
> onefang pushed a commit to branch master.
>
> commit d6b3e8848a6aaa132e4211c4a6bf2e764a74bcc6
> Author: David Walter Seikel <won_f...@yahoo.com.au>
> Date:   Wed May 22 12:55:41 2013 +1000
>
>     Stop leaking evas objects in Lua.
>
>     Bug and test case reported by Leif Middelschulte.
> ---
>  src/lib/edje/edje_lua2.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/edje/edje_lua2.c b/src/lib/edje/edje_lua2.c
> index ec5d48a..8bb7f02 100644
> --- a/src/lib/edje/edje_lua2.c
> +++ b/src/lib/edje/edje_lua2.c
> @@ -327,9 +327,13 @@ _elua_obj_new(lua_State *L, Edje *ed, int size, const 
> char *metatable)  // Stack
>  }
>
>  static void
> -_elua_obj_free(lua_State *L EINA_UNUSED, Edje_Lua_Obj *obj)
> +_elua_obj_free(lua_State *L, Edje_Lua_Obj *obj)
>  {
>     if (!obj->free_func) return;
> +   // Free the reference, so it will actually get gc'd.
> +   // It seems that being a completely weak table isn't enough.
> +   lua_pushnil(L);                                  // Stack usage [-0, +1, 
> -]
> +   _elua_ref_set(L, obj);                           // Stack usage [-4, +4, 
> m]
>     obj->free_func(obj);
>     obj->ed->lua_objs = eina_inlist_remove(obj->ed->lua_objs, 
> EINA_INLIST_GET(obj));
>     obj->free_func = NULL;
> @@ -3888,7 +3892,7 @@ _elua_init(void)
>     lua_pushlightuserdata(L, &_elua_objs);                                    
>               // Stack usage [-0, +1, -]
>     lua_newtable(L);                                                          
>               // Stack usage [-0, +1, m]
>     lua_pushstring(L, "__mode");                                              
>               // Stack usage [-0, +1, m]
> -   lua_pushstring(L, "v");                                                   
>               // Stack usage [-0, +1, m]
> +   lua_pushstring(L, "kv");                                                  
>               // Stack usage [-0, +1, m]
>     lua_rawset(L, -3);                                                        
>               // Stack usage [-2, +0, m]
>     lua_rawset(L, LUA_REGISTRYINDEX);                                         
>               // Stack usage [-2, +0, m]
>  }
> @@ -3978,7 +3982,7 @@ _edje_lua2_script_init(Edje *ed)                        
>           // Stack usage
>     lua_pushlightuserdata(L, &_elua_objs);                         // Stack 
> usage [-0, +1, -]
>     lua_newtable(L);                                               // Stack 
> usage [-0, +1, m]
>     lua_pushstring(L, "__mode");                                   // Stack 
> usage [-0, +1, m]
> -   lua_pushstring(L, "v");                                        // Stack 
> usage [-0, +1, m]
> +   lua_pushstring(L, "kv");                                       // Stack 
> usage [-0, +1, m]
>     lua_rawset(L, -3);                                             // Stack 
> usage [-2, +0, m]
>     lua_rawset(L, LUA_REGISTRYINDEX);                              // Stack 
> usage [-2, +0, m]
>
>
> --
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to