forked from enlightenment/enlightenment
hunting a nasty bug - FIXME in there with comments. this fixes it so e starts
anyway SVN revision: 26232
This commit is contained in:
parent
24ff102f10
commit
cc673bba74
|
@ -151,7 +151,7 @@ e_app_init(void)
|
|||
{
|
||||
E_App *app;
|
||||
|
||||
snprintf(buf, PATH_MAX, "%s/%s", _e_apps_path_all, file);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", _e_apps_path_all, file);
|
||||
app = e_app_empty_new(buf);
|
||||
if ((app) && (app->path))
|
||||
_e_apps_every_app = evas_hash_direct_add(_e_apps_every_app, app->path, app);
|
||||
|
@ -218,6 +218,7 @@ _e_apps_hash_idler_cb_init(Evas_Hash *hash, const char *key, void *data, void *f
|
|||
if (!a->filled)
|
||||
{
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) return 1;
|
||||
idler->all_done = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -370,6 +371,7 @@ e_app_new(const char *path, int scan_subdirs)
|
|||
a->filled = 1;
|
||||
}
|
||||
}
|
||||
if (!a->filled) goto error;
|
||||
if (scan_subdirs)
|
||||
{
|
||||
if (stated)
|
||||
|
@ -429,15 +431,13 @@ e_app_empty_new(const char *path)
|
|||
E_App *a;
|
||||
|
||||
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
|
||||
if (a)
|
||||
{
|
||||
if (!a) return NULL;
|
||||
/* no image for now */
|
||||
a->image = NULL;
|
||||
a->width = 0;
|
||||
a->height = 0;
|
||||
/* record the path, or make one up */
|
||||
if (path)
|
||||
a->path = evas_stringshare_add(path);
|
||||
if (path) a->path = evas_stringshare_add(path);
|
||||
else if (_e_apps_path_all)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
@ -445,7 +445,7 @@ e_app_empty_new(const char *path)
|
|||
snprintf(buf, sizeof(buf), "%s/_new_app_%1.1f.desktop", _e_apps_path_all, ecore_time_get());
|
||||
a->path = evas_stringshare_add(buf);
|
||||
}
|
||||
}
|
||||
printf("NEW APP %p %s\n", a, a->path);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -1073,8 +1073,8 @@ e_app_border_find(E_Border *bd)
|
|||
a = l->data;
|
||||
E_OBJECT_CHECK_RETURN(a, NULL);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
ok = 0;
|
||||
if ((a->win_name) || (a->win_class) || (a->win_title) || (a->win_role) || (a->exe))
|
||||
{
|
||||
|
@ -1196,6 +1196,7 @@ e_app_name_find(const char *name)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->name)
|
||||
{
|
||||
if (!strcasecmp(a->name, name))
|
||||
|
@ -1226,6 +1227,7 @@ e_app_generic_find(const char *generic)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->generic)
|
||||
{
|
||||
if (!strcasecmp(a->generic, generic))
|
||||
|
@ -1256,6 +1258,7 @@ e_app_exe_find(const char *exe)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->exe)
|
||||
{
|
||||
if (!strcmp(a->exe, exe))
|
||||
|
@ -1288,6 +1291,7 @@ e_app_name_glob_list(const char *name)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->name)
|
||||
{
|
||||
if (e_util_glob_case_match(a->name, name))
|
||||
|
@ -1314,6 +1318,7 @@ e_app_generic_glob_list(const char *generic)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->generic)
|
||||
{
|
||||
if (e_util_glob_case_match(a->generic, generic))
|
||||
|
@ -1340,6 +1345,7 @@ e_app_exe_glob_list(const char *exe)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled) continue;
|
||||
if (a->exe)
|
||||
{
|
||||
if (e_util_glob_match(a->exe, exe))
|
||||
|
@ -1366,6 +1372,8 @@ e_app_comment_glob_list(const char *comment)
|
|||
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, NULL);
|
||||
if (!a->filled)
|
||||
e_app_fields_fill(a, a->path);
|
||||
if (!a->filled)
|
||||
continue;
|
||||
if (a->comment)
|
||||
{
|
||||
if (e_util_glob_case_match(a->comment, comment))
|
||||
|
@ -1383,7 +1391,6 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
const char *lang, *ext;
|
||||
int size;
|
||||
|
||||
a->filled = 1;
|
||||
/* get our current language */
|
||||
lang = e_intl_language_alias_get();
|
||||
|
||||
|
@ -1427,6 +1434,8 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
a->no_icon = 0;
|
||||
a->found_icon = 0;
|
||||
|
||||
a->filled = 1;
|
||||
|
||||
// if (desktop->type) a->type = evas_stringshare_add(desktop->type);
|
||||
// if (desktop->categories) a->categories = evas_stringshare_add(desktop->categories);
|
||||
}
|
||||
|
@ -1484,6 +1493,7 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
free(v);
|
||||
}
|
||||
eet_close(ef);
|
||||
a->filled = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2151,6 +2161,19 @@ _e_app_new_save(E_App *a)
|
|||
static void
|
||||
_e_app_free(E_App *a)
|
||||
{
|
||||
if (a->path)
|
||||
_e_apps_every_app = evas_hash_del(_e_apps_every_app, a->path, a);
|
||||
|
||||
/* FIXME: natsy - but trying to fix a bug */
|
||||
/* somehow apps for "startup" end up in subapps of _e_apps_all and
|
||||
* when thet startup app aprent is freed the subapps of the startup are
|
||||
* freed but the list entries for _e_apps_all->subapps is still there
|
||||
* and so u have a nasty dangling pointer to garbage memory
|
||||
*/
|
||||
if (_e_apps_all)
|
||||
_e_apps_all->subapps = evas_list_remove_list(_e_apps_all->subapps, a);
|
||||
/* END FIXME */
|
||||
|
||||
while (evas_list_find(_e_apps_start_pending, a))
|
||||
_e_apps_start_pending = evas_list_remove(_e_apps_start_pending, a);
|
||||
if (a->orig)
|
||||
|
@ -2226,10 +2249,7 @@ _e_app_free(E_App *a)
|
|||
ecore_file_monitor_del(a->monitor);
|
||||
e_app_fields_empty(a);
|
||||
if (a->path)
|
||||
{
|
||||
_e_apps_every_app = evas_hash_del(_e_apps_every_app, a->path, a);
|
||||
evas_stringshare_del(a->path);
|
||||
}
|
||||
free(a);
|
||||
}
|
||||
}
|
||||
|
@ -2261,7 +2281,7 @@ _e_app_change(E_App *a, E_App_Change ch)
|
|||
if (ch == E_APP_DEL)
|
||||
printf("APP_DEL %s\n", a->path);
|
||||
if (ch == E_APP_CHANGE)
|
||||
printf("APP_CHANGE %s\n", a->path);
|
||||
printf("APP_CHANGE %p %s\n", a, a->path);
|
||||
if (ch == E_APP_ADD)
|
||||
printf("APP_ADD %s\n", a->path);
|
||||
_e_apps_callbacks_walking = 1;
|
||||
|
@ -2337,6 +2357,8 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
|
|||
{
|
||||
e_app_fields_empty(app);
|
||||
e_app_fields_fill(app, path);
|
||||
if (app->filled)
|
||||
{
|
||||
_e_app_change(app, E_APP_CHANGE);
|
||||
for (l = app->references; l; l = l->next)
|
||||
{
|
||||
|
@ -2346,6 +2368,7 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
|
|||
if (_e_app_copy(a2, app)) _e_app_change(a2, E_APP_CHANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event == ECORE_FILE_EVENT_DELETED_FILE)
|
||||
{
|
||||
e_app_fields_empty(app);
|
||||
|
@ -2373,6 +2396,8 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
|
|||
|
||||
e_app_fields_empty(a);
|
||||
e_app_fields_fill(a, path);
|
||||
if (a->filled)
|
||||
{
|
||||
if (!_e_app_exe_valid_get(a->exe))
|
||||
{
|
||||
a->deleted = 1;
|
||||
|
@ -2402,6 +2427,7 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((event == ECORE_FILE_EVENT_CREATED_FILE) ||
|
||||
(event == ECORE_FILE_EVENT_CREATED_DIRECTORY))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue