Hi Guys,

I've tested ephysics with valgrind seeking for memory leaks and found a 
situation with edje EXTERNAL.
It obviously leaks externals parsed params data. But I'm not sure where the fix 
should be done.

On edje_load.c in the line 863 the objects params are parsed and allocated, 
this data should be freed
in the function _edje_file_del() line 1357, where 
_edje_external_parsed_params_free() is called, this
function will try to get the "Edje_External_Type" from 
rp->typedata.swallow->swallowed_object to define
who should be called to free the params.

I traced the code execution and found that in this point the swallowed_object 
was already freed - what
results in evas_object_data_get(obj, "Edje_External_Type") returning NULL. I 
saw the eo's _destructor
was called before _edje_external_parsed_params_free() takes place.

I've coped the scenario with a very little example using edje EXTERNAL with 
elm/button source. See that
external_button_params_free() is never called, since swallowed object was 
removed before the external
edje external part.

I'm attaching a source code you can use to test it. If you run it with valgrind 
will see the following
stack:

==4706==    by 0x6823221: _edje_external_params_parse (edje_external.c:624)
==4706==    by 0x68261B7: _edje_object_file_set_internal (edje_load.c:863)
==4706==    by 0x68360E7: _edje_smart_file_set (edje_smart.c:310)
==4706==    by 0xC2D1990: _eo_op_internal (eo.c:363)
==4706==    by 0xC2D36CE: eo_do_internal (eo.c:403)
==4706==    by 0x682393E: edje_object_file_set (edje_load.c:79)
==4706==    by 0x4F13AD2: _elm_layout_smart_file_set (elm_layout.c:1459)
==4706==    by 0xC2D1990: _eo_op_internal (eo.c:363)
==4706==    by 0xC2D36CE: eo_do_internal (eo.c:403)
==4706==    by 0x4F16771: elm_layout_file_set (elm_layout.c:1444)


Regards...

-- 
Leandro Dorileo
ProFUSION embedded systems
http://profusion.mobi
externals {
   external: "elm";
}

collections {

   group {
      name: "my_group";

      parts {

         part {
            name: "test_button";
            type: EXTERNAL;
            source: "elm/button";
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1.relative: 1 0.08;
               rel2.relative: 1 0.08;
               color: 255 0 0 255;
               fixed: 1 1;
               align: 1 0.5;
            }

         }
      }
   }
}
#include <Elementary.h>

#define WIDTH 500
#define HEIGHT 500

EAPI_MAIN int
elm_main(int argc, char **argv)
{
  Evas_Object *layout, *win, *bg;
  
  win = elm_win_add(NULL, "Test", ELM_WIN_BASIC);
  elm_win_title_set(win, "Test");
  elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
  elm_win_autodel_set(win, EINA_TRUE);

  layout = elm_layout_add(win);
  elm_win_resize_object_add(win, layout);
  elm_layout_file_set(layout, "./test.edj", "my_group");
  evas_object_show(layout);
  
  bg = elm_bg_add(win);
  elm_bg_color_set(bg, 255,255 ,255);
  evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  elm_win_resize_object_add(win, bg);
  evas_object_show(bg);
  
  evas_object_resize(win, WIDTH, HEIGHT);
  evas_object_show(win);
  
  elm_run();
  elm_shutdown();
  
  return 0;
}
ELM_MAIN()
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to