From 11c6bde8d8ddcdae8e473810c6ed2d500934d816 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 24 Oct 2005 01:17:01 +0000 Subject: [PATCH] FIX a fm segv - put a note as to why :) SVN revision: 17861 --- TODO | 4 ++-- src/bin/e_fileman_file.c | 8 +++++++- src/bin/e_fileman_smart.c | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index f83786239..5dc2acd96 100644 --- a/TODO +++ b/TODO @@ -30,8 +30,6 @@ Some of the things (in very short form) that need to be done to E17... ESSENTIAL FEATURES ------------------------------------------------------------------------------- -* return from ipc if the command failed or not -* ipc should give more feedback wheter the options are accepted or not. * emit signal to submenu entries if they have a submenu shown for them or not * add fullscreen support (e16 xvidmode or xrandr style) * implement thees maximise/fullscreen modes: @@ -109,6 +107,8 @@ Some of the things (in very short form) that need to be done to E17... CLEANUPS ------------------------------------------------------------------------------- +* return from ipc if the command failed or not +* ipc should give more feedback wheter the options are accepted or not. * find all other instances of using e_error dialogs and use them only with low level errors than need attention no matter what. * winlist should support place for window "screenshot" in list as well as diff --git a/src/bin/e_fileman_file.c b/src/bin/e_fileman_file.c index 040912855..2945b4711 100644 --- a/src/bin/e_fileman_file.c +++ b/src/bin/e_fileman_file.c @@ -51,7 +51,13 @@ e_fm_file_new(const char *filename) struct stat st; if (stat(filename, &st) == -1) return NULL; - + /* FIXME: stat above will fail if the file is a BROKEN SYMLINK - maybe we + * should not fail, but do an lstat here and see if it is a symlink (or + * just a race condition where the file was deleted as we scan), and + * if so mark it as a broken synlink. we should do an lstat ANYWAY + * so we know if a file is a symlink or not regardless what it points + * to. + */ file = E_OBJECT_ALLOC(E_Fm_File, E_FM_FILE_TYPE, _e_fm_file_free); if (!file) return NULL; file->path = strdup(filename); diff --git a/src/bin/e_fileman_smart.c b/src/bin/e_fileman_smart.c index 7a40c65b1..f1c679710 100644 --- a/src/bin/e_fileman_smart.c +++ b/src/bin/e_fileman_smart.c @@ -1391,6 +1391,7 @@ _e_fm_dir_files_get(E_Fm_Smart_Data *sd, int type) while ((dir_entry = readdir(dir)) != NULL) { E_Fm_Icon *icon; + if ((!strcmp(dir_entry->d_name, ".") || (!strcmp (dir_entry->d_name, "..")))) continue; if ((dir_entry->d_name[0] == '.') && (!(type & E_FM_FILE_TYPE_HIDDEN))) continue; @@ -1398,11 +1399,18 @@ _e_fm_dir_files_get(E_Fm_Smart_Data *sd, int type) if (!icon) continue; snprintf(path, sizeof(path), "%s/%s", sd->dir, dir_entry->d_name); icon->file = e_fm_file_new(path); - icon->icon_object = e_fm_icon_add(sd->evas); - icon->sd = sd; - e_fm_icon_file_set(icon->icon_object, icon->file); - evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h); - files = evas_list_append(files, icon); + if (!icon->file) + { + E_FREE(icon); + } + else + { + icon->icon_object = e_fm_icon_add(sd->evas); + icon->sd = sd; + e_fm_icon_file_set(icon->icon_object, icon->file); + evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h); + files = evas_list_append(files, icon); + } } closedir(dir);