From 3c213cec8c2aab1a53d0d5cb9d87659b584ac876 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Wed, 3 Apr 2013 22:47:48 +0200 Subject: Checking file presence before calling lstat (should fix Bug #785701 Inkscape freezes at opening) (bzr r12263) --- src/inkscape.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index ac419784f..eca19c4b9 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -364,15 +364,17 @@ static gint inkscape_autosave(gpointer) while( (filename = g_dir_read_name(autosave_dir_ptr)) != NULL ){ if ( strncmp(filename, baseName, strlen(baseName)) == 0 ){ gchar* full_path = g_build_filename( autosave_dir.c_str(), filename, NULL ); - if ( g_stat(full_path, &sb) != -1 ) { - if ( difftime(sb.st_ctime, min_time) < 0 || min_time == 0 ){ - min_time = sb.st_ctime; - if ( oldest_autosave ) { - g_free(oldest_autosave); + if (g_file_test (full_path, G_FILE_TEST_EXISTS)){ + if ( g_stat(full_path, &sb) != -1 ) { + if ( difftime(sb.st_ctime, min_time) < 0 || min_time == 0 ){ + min_time = sb.st_ctime; + if ( oldest_autosave ) { + g_free(oldest_autosave); + } + oldest_autosave = g_strdup(full_path); } - oldest_autosave = g_strdup(full_path); + count ++; } - count ++; } g_free(full_path); } -- cgit v1.2.3