# HG changeset patch # User zas_ # Date 1207595177 0 # Node ID 3f14da3c3b9ad85c5bbe830eead39c8b233e336a # Parent 1015282898fedbd5f7e2ce41574d59f47c3e2e09 Fix a segfault on fullscreen file deletion reported by Frdric Mantegazza. diff -r 1015282898fe -r 3f14da3c3b9a src/image-overlay.c --- a/src/image-overlay.c Mon Apr 07 18:52:54 2008 +0000 +++ b/src/image-overlay.c Mon Apr 07 19:06:17 2008 +0000 @@ -258,32 +258,33 @@ g_free(name_escaped); g_hash_table_destroy(vars); + text2 = text; { FileData *fd = image_get_fd(imd); - gint active_marks = 0; - gint mark; - for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++) + if (fd) /* fd may be null after file deletion */ { - active_marks += fd->marks[mark]; - } + gint active_marks = 0; + gint mark; - if (active_marks > 0) - { - GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2); - for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++) { - g_string_append_printf(buf, fd->marks[mark] ? " %c" : " %c", '1' + mark); - } + active_marks += fd->marks[mark]; + } - text2 = g_strdup_printf("%s\n%s", text, buf->str); - g_string_free(buf, TRUE); - g_free(text); - } - else - { - text2 = text; + if (active_marks > 0) + { + GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2); + + for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++) + { + g_string_append_printf(buf, fd->marks[mark] ? " %c" : " %c", '1' + mark); + } + + text2 = g_strdup_printf("%s\n%s", text, buf->str); + g_string_free(buf, TRUE); + g_free(text); + } } }