Patch attached.

I don't know if this is the correct fix, but it does seem to work in the limited testing that I've done. The problem only happens when specifying an image filename on the commandline. Simply specifying a directory works fine.

--xsdg
>From 4e29db57ca00952c7485758099034c058916331f Mon Sep 17 00:00:00 2001
From: Omari Stephens <x...@xsdg.org>
Date: Mon, 27 Feb 2012 06:02:02 +0000
Subject: [PATCH] Fix segfault when a filename is specified on the commandline

Somehow, the file-specified-on-commandline codepath developed a
dependency on the options global, which hadn't been initialized
yet.  This change simply moves the commandline parsing to below
the options variable initialization.

(gdb) r /PATH/TO/FILE.jpg
[...]
(gdb) bt
#0  0x00000000004559d2 in filelist_read_real (dir_path=<optimized out>,
    files=0x7fffffffe638, dirs=0x0, follow_symlinks=<optimized out>)
    at filedata.c:955
#1  0x0000000000455f0c in file_data_new_group (
    path_utf8=0x773300 "/PATH/TO/FILE.jpg") at filedata.c:1040
#2  0x000000000047472f in parse_command_line_add_file (
    file_path=<optimized out>, path=0x773da8, file=0x773db0,
    list=0x7fffffffe758, collection_list=0x773dc0) at main.c:128
#3  0x0000000000419ae2 in parse_command_line_process_file (
    first_dir=0x7fffffffe768, collection_list=<optimized out>,
    list=0x7fffffffe758, file=<optimized out>, path=<optimized out>,
    file_path=0x773220 "/PATH/TO/FILE.jpg") at main.c:205
#4  parse_command_line (argv=0x7fffffffe888, argc=<optimized out>)
    at main.c:241
#5  main (argc=2, argv=0x7fffffffe888) at main.c:805
---
 src/main.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 1ddee03..9b25b4c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -801,9 +801,6 @@ gint main(gint argc, gchar *argv[])
 	DEBUG_1("%s main: pixbuf_inline_register_stock_icons", get_exec_time());	 
 	pixbuf_inline_register_stock_icons();
 
-	DEBUG_1("%s main: parse_command_line", get_exec_time());	 
-	parse_command_line(argc, argv);
-
 	DEBUG_1("%s main: mkdir_if_not_exists", get_exec_time());	 
 	/* these functions don't depend on config file */
 	mkdir_if_not_exists(get_rc_dir());
@@ -821,6 +818,9 @@ gint main(gint argc, gchar *argv[])
 	options = init_options(NULL);
 	setup_default_options(options);
 
+	DEBUG_1("%s main: parse_command_line", get_exec_time());
+	parse_command_line(argc, argv);
+
 	DEBUG_1("%s main: load_options", get_exec_time());	 
 	if (!load_options(options))
 		{
-- 
1.7.2.3

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel

Reply via email to