Ephoto: Fix memory leaks and make single browser monitoring work correctly.
This commit is contained in:
parent
e27b26ebe1
commit
d1b7b74464
|
@ -740,12 +740,16 @@ _monitor_cb(void *data, int type,
|
||||||
char file[PATH_MAX], dir[PATH_MAX];
|
char file[PATH_MAX], dir[PATH_MAX];
|
||||||
const Elm_Genlist_Item_Class *ic;
|
const Elm_Genlist_Item_Class *ic;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
char *freedir;
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
snprintf(file, PATH_MAX, "%s", ev->filename);
|
snprintf(file, PATH_MAX, "%s", ev->filename);
|
||||||
snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
|
freedir = ecore_file_dir_get(file);
|
||||||
|
snprintf(dir, PATH_MAX, "%s", freedir);
|
||||||
|
if (freedir) free(freedir);
|
||||||
|
|
||||||
if (strcmp(entry->path, dir))
|
if (strcmp(entry->path, dir))
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED)
|
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED)
|
||||||
|
@ -879,11 +883,14 @@ _top_monitor_cb(void *data, int type,
|
||||||
Eio_Monitor_Event *ev = event;
|
Eio_Monitor_Event *ev = event;
|
||||||
const Elm_Genlist_Item_Class *ic;
|
const Elm_Genlist_Item_Class *ic;
|
||||||
char buf[PATH_MAX], file[PATH_MAX], dir[PATH_MAX];
|
char buf[PATH_MAX], file[PATH_MAX], dir[PATH_MAX];
|
||||||
|
char *freedir;
|
||||||
|
|
||||||
if (!db)
|
if (!db)
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
snprintf(file, PATH_MAX, "%s", ev->filename);
|
snprintf(file, PATH_MAX, "%s", ev->filename);
|
||||||
snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
|
freedir = ecore_file_dir_get(file);
|
||||||
|
snprintf(dir, PATH_MAX, "%s", freedir);
|
||||||
|
if (freedir) free(freedir);
|
||||||
|
|
||||||
if (strcmp(db->ephoto->top_directory, dir))
|
if (strcmp(db->ephoto->top_directory, dir))
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
@ -1095,6 +1102,7 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
Ecore_Event_Handler *handler;
|
Ecore_Event_Handler *handler;
|
||||||
|
|
||||||
_todo_items_free(db);
|
_todo_items_free(db);
|
||||||
|
elm_drop_item_container_del(db->fsel);
|
||||||
EINA_LIST_FREE(db->handlers, handler) ecore_event_handler_del(handler);
|
EINA_LIST_FREE(db->handlers, handler) ecore_event_handler_del(handler);
|
||||||
if (db->animator.todo_items)
|
if (db->animator.todo_items)
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,7 +237,9 @@ _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
EINA_LIST_FREE(ephoto->monitor_handlers, handler)
|
EINA_LIST_FREE(ephoto->monitor_handlers, handler)
|
||||||
ecore_event_handler_del(handler);
|
ecore_event_handler_del(handler);
|
||||||
}
|
}
|
||||||
|
ephoto_entries_free(ephoto);
|
||||||
ephoto_config_save(ephoto);
|
ephoto_config_save(ephoto);
|
||||||
|
free(ephoto->config);
|
||||||
free(ephoto);
|
free(ephoto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,13 +746,14 @@ _ephoto_populate_filter(void *data, Eio_File *handler EINA_UNUSED,
|
||||||
}
|
}
|
||||||
else if (info->type == EINA_FILE_LNK && ecore_file_is_dir((const char *)realpath))
|
else if (info->type == EINA_FILE_LNK && ecore_file_is_dir((const char *)realpath))
|
||||||
{
|
{
|
||||||
|
Eina_Bool _is_dir = ecore_file_is_dir(realpath);
|
||||||
if (ed->thumbs_only)
|
if (ed->thumbs_only)
|
||||||
{
|
{
|
||||||
free(realpath);
|
free(realpath);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
free(realpath);
|
free(realpath);
|
||||||
return ecore_file_is_dir(ecore_file_realpath(info->path));
|
return _is_dir;
|
||||||
}
|
}
|
||||||
else if (!ed->dirs_only)
|
else if (!ed->dirs_only)
|
||||||
{
|
{
|
||||||
|
@ -820,9 +823,12 @@ _monitor_cb(void *data, int type,
|
||||||
Ephoto *ephoto = data;
|
Ephoto *ephoto = data;
|
||||||
Eio_Monitor_Event *ev = event;
|
Eio_Monitor_Event *ev = event;
|
||||||
char file[PATH_MAX], dir[PATH_MAX];
|
char file[PATH_MAX], dir[PATH_MAX];
|
||||||
|
char *freedir;
|
||||||
|
|
||||||
snprintf(file, PATH_MAX, "%s", ev->filename);
|
snprintf(file, PATH_MAX, "%s", ev->filename);
|
||||||
snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
|
freedir = ecore_file_dir_get(file);
|
||||||
|
snprintf(dir, PATH_MAX, "%s", freedir);
|
||||||
|
if (freedir) free(freedir);
|
||||||
|
|
||||||
if (!type)
|
if (!type)
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
|
@ -74,6 +74,11 @@ static void _ephoto_main_del(void *data, Evas *e EINA_UNUSED,
|
||||||
static void _next_entry(Ephoto_Single_Browser *sb);
|
static void _next_entry(Ephoto_Single_Browser *sb);
|
||||||
static void _orient_apply(Ephoto_Single_Browser *sb);
|
static void _orient_apply(Ephoto_Single_Browser *sb);
|
||||||
|
|
||||||
|
/*Vewer Callbacks*/
|
||||||
|
static double _viewer_zoom_get(Evas_Object *obj);
|
||||||
|
static void _viewer_zoom_set(Evas_Object *obj, double zoom);
|
||||||
|
static void _viewer_zoom_fit(Evas_Object *obj);
|
||||||
|
|
||||||
/*Common*/
|
/*Common*/
|
||||||
static const char *
|
static const char *
|
||||||
_ephoto_get_edje_group(const char *path)
|
_ephoto_get_edje_group(const char *path)
|
||||||
|
@ -303,19 +308,11 @@ _monitor_cb(void *data, int type,
|
||||||
Ephoto_Single_Browser *sb = data;
|
Ephoto_Single_Browser *sb = data;
|
||||||
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
|
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
|
||||||
|
|
||||||
if (eina_list_count(sb->history))
|
if (eina_list_count(sb->history) > 1)
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
if (type == EIO_MONITOR_FILE_MODIFIED)
|
if (type == EIO_MONITOR_FILE_MODIFIED)
|
||||||
{
|
{
|
||||||
if (!ecore_file_exists(sb->entry->path))
|
if (ecore_file_exists(sb->entry->path))
|
||||||
{
|
|
||||||
if (eina_list_count(sb->entries) > 1)
|
|
||||||
_next_entry(sb);
|
|
||||||
else
|
|
||||||
_ephoto_main_back(sb, NULL, NULL);
|
|
||||||
ephoto_entry_free(sb->ephoto, sb->entry);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Evas_Object *tmp;
|
Evas_Object *tmp;
|
||||||
Evas_Coord w, h;
|
Evas_Coord w, h;
|
||||||
|
@ -328,12 +325,21 @@ _monitor_cb(void *data, int type,
|
||||||
|
|
||||||
if (w > 0 && h > 0)
|
if (w > 0 && h > 0)
|
||||||
{
|
{
|
||||||
evas_object_hide(v->image);
|
Eina_Bool fit = v->fit;
|
||||||
evas_object_image_file_set(v->image, sb->entry->path, group);
|
double zoom = _viewer_zoom_get(sb->viewer);
|
||||||
evas_object_show(v->image);
|
|
||||||
|
_ephoto_single_browser_recalc(sb);
|
||||||
|
if (fit)
|
||||||
|
_viewer_zoom_fit(sb->viewer);
|
||||||
|
else
|
||||||
|
_viewer_zoom_set(sb->viewer, zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (type == EIO_MONITOR_FILE_DELETED)
|
||||||
|
{
|
||||||
|
_ephoto_main_back(sb, NULL, NULL);
|
||||||
|
}
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2091,6 +2097,7 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
if (!strncmp(bname, "tmp", 3))
|
if (!strncmp(bname, "tmp", 3))
|
||||||
ecore_file_unlink(info->path);
|
ecore_file_unlink(info->path);
|
||||||
}
|
}
|
||||||
|
eina_iterator_free(tmps);
|
||||||
if (sb->history)
|
if (sb->history)
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(sb->history, eh)
|
EINA_LIST_FREE(sb->history, eh)
|
||||||
|
|
|
@ -1282,6 +1282,7 @@ _ephoto_thumb_search_cancel(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
Evas_Object *hbox = evas_object_data_get(search, "parent");
|
Evas_Object *hbox = evas_object_data_get(search, "parent");
|
||||||
Ephoto_Thumb_Browser *tb = evas_object_data_get(search, "thumb_browser");
|
Ephoto_Thumb_Browser *tb = evas_object_data_get(search, "thumb_browser");
|
||||||
|
|
||||||
|
elm_drag_item_container_del(tb->grid);
|
||||||
tb->entries = tb->ephoto->entries;
|
tb->entries = tb->ephoto->entries;
|
||||||
if (eina_list_count(tb->ephoto->searchentries))
|
if (eina_list_count(tb->ephoto->searchentries))
|
||||||
eina_list_free(tb->ephoto->searchentries);
|
eina_list_free(tb->ephoto->searchentries);
|
||||||
|
@ -1841,6 +1842,8 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
Ecore_Event_Handler *handler;
|
Ecore_Event_Handler *handler;
|
||||||
|
|
||||||
_todo_items_free(tb);
|
_todo_items_free(tb);
|
||||||
|
elm_drop_item_container_del(tb->grid);
|
||||||
|
elm_drag_item_container_del(tb->grid);
|
||||||
EINA_LIST_FREE(tb->handlers, handler) ecore_event_handler_del(handler);
|
EINA_LIST_FREE(tb->handlers, handler) ecore_event_handler_del(handler);
|
||||||
if (tb->animator.todo_items)
|
if (tb->animator.todo_items)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue