e menu - try fix a bug in e apps menu crashes with new efreet api
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 23 Jul 2014 11:38:01 +0000 (20:38 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 23 Jul 2014 11:38:01 +0000 (20:38 +0900)
this fixes T1441 - or tries.. since it's not easily reproduced, this
is a try and understanding the problem and being conservative by
refcounting until the data is no longer needed. combined with its
needed new api's from 356d10fbeefd3f79f3cc848ed266d33e04ac7238 i hope
this works.

configure.ac
src/bin/e_int_menus.c

index 148d727..826587d 100644 (file)
@@ -92,7 +92,7 @@ extern char **environ;
 AC_DEFINE(HAVE_ENVIRON, 1, [Have environ var])
     ])
 
-efl_version="1.10"
+efl_version="1.10.99"
 AC_SUBST(efl_version)
 
 AC_CHECK_HEADERS([sys/timerfd.h sys/ptrace.h arpa/inet.h netinet/in.h])
index 45c95df..5819ed9 100644 (file)
@@ -801,6 +801,7 @@ _e_int_menus_apps_scan(E_Menu *m, Efreet_Menu *menu)
                   E_Menu *subm;
 
                   subm = e_menu_new();
+                  efreet_menu_ref(entry);
                   e_menu_pre_activate_callback_set(subm,
                                                    _e_int_menus_apps_start,
                                                    entry);
@@ -927,6 +928,12 @@ _e_int_menus_apps_start(void *data, E_Menu *m)
      ecore_timer_reset(_e_int_menus_app_cleaner);
    eina_stringshare_del(dir);
    _e_int_menus_apps_scan(m, menu);
+   if (m->pre_activate_cb.func == _e_int_menus_apps_start)
+     {
+        efreet_menu_unref(m->pre_activate_cb.data);
+        m->pre_activate_cb.func = NULL;
+        m->pre_activate_cb.data = NULL;
+     }
    e_menu_pre_activate_callback_set(m, NULL, NULL);
    e_object_data_set(E_OBJECT(m), menu);
    e_object_free_attach_func_set(E_OBJECT(m),
@@ -941,6 +948,13 @@ _e_int_menus_apps_free_hook2(void *obj)
    E_Menu_Item *mi;
 
    m = obj;
+   // unref the e menu we had pointed to in the pre activate cb */
+   if (m->pre_activate_cb.func == _e_int_menus_apps_start)
+     {
+        efreet_menu_unref(m->pre_activate_cb.data);
+        m->pre_activate_cb.func = NULL;
+        m->pre_activate_cb.data = NULL;
+     }
    // XXX TODO: this should be automatic in e_menu, just get references right!
    // XXX TODO: fix references and remove me!!!
    EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi)