Revision: 831 http://svn.sourceforge.net/geany/?rev=831&view=rev Author: ntrel Date: 2006-09-22 05:05:18 -0700 (Fri, 22 Sep 2006)
Log Message: ----------- Prevent a segfault if the Terminal tool is not set. Use cmd.exe as default Terminal tool on Windows.
Modified Paths: -------------- trunk/ChangeLog trunk/src/build.c trunk/src/geany.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-09-22 11:38:14 UTC (rev 830) +++ trunk/ChangeLog 2006-09-22 12:05:18 UTC (rev 831) @@ -1,6 +1,9 @@ 2006-09-22 Nick Treleaven nick.treleaven@btinternet.com
* src/main.c: Apply toolbar style on startup (Fixes #1563125). + * src/build.c src/geany.h: + Prevent a segfault if the Terminal tool is not set. + Use cmd.exe as default Terminal tool on Windows.
2006-09-21 Nick Treleaven nick.treleaven@btinternet.com
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2006-09-22 11:38:14 UTC (rev 830) +++ trunk/src/build.c 2006-09-22 12:05:18 UTC (rev 831) @@ -107,7 +107,7 @@ #ifdef G_OS_WIN32 argv = NULL; child_pid = (GPid) 0; - + if (! g_spawn_command_line_async(locale_cmd_string, &error)) #else argv = g_new0(gchar *, 4); @@ -363,11 +363,6 @@
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
- locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd); - // split the term_cmd, so arguments will work too - term_argv = g_strsplit(locale_term_cmd, " ", -1); - term_argv_len = g_strv_length(term_argv); - long_executable = utils_remove_ext_from_filename(locale_filename); #ifdef G_OS_WIN32 long_executable = g_strconcat(long_executable, ".exe", NULL); @@ -405,13 +400,22 @@ } }
+ /* get the terminal path */ + locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd); + // split the term_cmd, so arguments will work too + term_argv = g_strsplit(locale_term_cmd, " ", -1); + term_argv_len = g_strv_length(term_argv);
- // check if terminal path is set (to prevent misleading error messages) - tmp = term_argv[0]; - term_argv[0] = g_find_program_in_path(tmp); - g_free(tmp); - if (stat(term_argv[0], &st) != 0) + // check that terminal exists (to prevent misleading error messages) + if (term_argv[0] != NULL) { + tmp = term_argv[0]; + // g_find_program_in_path checks tmp exists and is executable + term_argv[0] = g_find_program_in_path(tmp); + g_free(tmp); + } + if (term_argv[0] == NULL) + { msgwin_status_add( _("Could not find terminal '%s' " "(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-09-22 11:38:14 UTC (rev 830) +++ trunk/src/geany.h 2006-09-22 12:05:18 UTC (rev 831) @@ -54,7 +54,11 @@ #define GEANY_WINDOW_DEFAULT_HEIGHT 600 // some default settings which are used at the very first start of Geany to fill configuration file #define GEANY_DEFAULT_TOOLS_MAKE "make" +#ifdef G_OS_WIN32 +#define GEANY_DEFAULT_TOOLS_TERMINAL "cmd.exe" +#else #define GEANY_DEFAULT_TOOLS_TERMINAL "xterm" +#endif #define GEANY_DEFAULT_TOOLS_BROWSER "mozilla" #define GEANY_DEFAULT_TOOLS_PRINTCMD "lpr" #define GEANY_DEFAULT_TOOLS_GREP "grep"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.