some extra object checks to catch wierdness/badness..

also fix segv if you have NO apps :)


SVN revision: 12925
This commit is contained in:
Carsten Haitzler 2005-01-12 13:59:01 +00:00
parent f937e4a170
commit 5cfae17870
2 changed files with 33 additions and 18 deletions

View File

@ -218,26 +218,29 @@ _e_int_menus_apps_scan(E_Menu *m)
a = e_object_data_get(E_OBJECT(m)); a = e_object_data_get(E_OBJECT(m));
e_app_subdir_scan(a, 0); e_app_subdir_scan(a, 0);
for (l = a->subapps; l; l = l->next) if (a)
{ {
a = l->data; for (l = a->subapps; l; l = l->next)
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, a->name);
if (a->exe)
{ {
e_menu_item_icon_edje_set(mi, a->path, "icon"); a = l->data;
e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
app_count++;
}
else
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/.directory.eet", a->path); mi = e_menu_item_new(m);
e_menu_item_icon_edje_set(mi, buf, "icon"); e_menu_item_label_set(mi, a->name);
e_menu_item_submenu_set(mi, e_int_menus_apps_new(a->path)); if (a->exe)
app_count++; {
e_menu_item_icon_edje_set(mi, a->path, "icon");
e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
app_count++;
}
else
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/.directory.eet", a->path);
e_menu_item_icon_edje_set(mi, buf, "icon");
e_menu_item_submenu_set(mi, e_int_menus_apps_new(a->path));
app_count++;
}
} }
} }
if (app_count == 0) if (app_count == 0)
@ -266,7 +269,7 @@ _e_int_menus_apps_del_hook(void *obj)
E_Menu_Item *mi; E_Menu_Item *mi;
mi = l->data; mi = l->data;
if (mi->submenu) e_object_del(mi->submenu); if (mi->submenu) e_object_del(E_OBJECT(mi->submenu));
} }
} }

View File

@ -184,6 +184,18 @@ e_object_error(E_Object *obj)
"%s", "%s",
obj, magic, obj, magic,
bt); bt);
else if (obj->references < 0)
snprintf(buf, sizeof(buf),
"Object [%p] has negative references (%i).\n"
"%s",
obj, obj->references,
bt);
else if (obj->references > 100)
snprintf(buf, sizeof(buf),
"Object [%p] has unusually high reference count (%i).\n"
"%s",
obj, obj->references,
bt);
/* it's all ok! */ /* it's all ok! */
else else
{ {