diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-04-05 19:09:30 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-04-05 19:09:30 +0000 |
| commit | 38d12b0b147681fbaf6b773394ea20abf184732c (patch) | |
| tree | ea5cd0d25e50f8637214fed33dc5d973a60ac5ce /src/sp-image.cpp | |
| parent | Merged FlowX classes. (diff) | |
| parent | Fix for Bug #1163759 (Mouse selection ignores transform). (diff) | |
| download | inkscape-38d12b0b147681fbaf6b773394ea20abf184732c.tar.gz inkscape-38d12b0b147681fbaf6b773394ea20abf184732c.zip | |
merged from trunk (r12265)
(bzr r11608.1.80)
Diffstat (limited to 'src/sp-image.cpp')
| -rw-r--r-- | src/sp-image.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 5961bf7fa..442d0e539 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -404,8 +404,12 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*& pixPath = NULL; } + //test correctness of filename + if (!g_file_test (filename, G_FILE_TEST_EXISTS)){ + return NULL; + } struct stat stdir; - g_stat(filename, &stdir); + int val = g_stat(filename, &stdir); if (stdir.st_mode & S_IFDIR){ //filename is not correct: it is a directory name and hence further code can not return valid results return NULL; @@ -416,11 +420,11 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*& if ( fp ) { { - struct stat st; - memset(&st, 0, sizeof(st)); - int val = g_stat(filename, &st); + // struct stat st; + // memset(&st, 0, sizeof(st)); + // int val = g_stat(filename, &st); if ( !val ) { - modTime = st.st_mtime; + modTime = stdir.st_mtime;//st.st_mtime; pixPath = g_strdup(filename); } } @@ -1471,7 +1475,10 @@ void sp_image_refresh_if_outdated( SPImage* image ) struct stat st; memset(&st, 0, sizeof(st)); - int val = g_stat(image->pixPath, &st); + int val = 0; + if (g_file_test (image->pixPath, G_FILE_TEST_EXISTS)){ + val = g_stat(image->pixPath, &st); + } if ( !val ) { // stat call worked. Check time now if ( st.st_mtime != image->lastMod ) { |
