[geany/geany] 095d88: VTE: Fix crash when trying to change VTE directory at startup
Colomban Wendling
git-noreply at xxxxx
Mon Aug 22 18:03:18 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 22 Aug 2016 18:03:18 UTC
Commit: 095d88958296200ee890dc2b45e0123f1559705b
https://github.com/geany/geany/commit/095d88958296200ee890dc2b45e0123f1559705b
Log Message:
-----------
VTE: Fix crash when trying to change VTE directory at startup
2150302fe6e88f88e5eba78502b478be2b78c662 introduced a bug, because
configuration_load_session_files() calls VTE code if vte_info.have_vte
is non-FALSE, before vte_init() has been called. So, it relied in the
implicit 0-initialization of the vte_info global, which the above
commit changed carelessly.
So, instead of altering vte_info.have_vte early, add a specific flag
for whether VTE is disabled on the command line.
Also, explicitly initialize vte_info to suggest to the reader the
default values does matter.
Modified Paths:
--------------
src/keyfile.c
src/libmain.c
src/vte.c
src/vte.h
Modified: src/keyfile.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -859,7 +859,7 @@ static void load_dialog_prefs(GKeyFile *config)
/* VTE */
#ifdef HAVE_VTE
vte_info.load_vte = utils_get_setting_boolean(config, "VTE", "load_vte", TRUE);
- if (vte_info.load_vte && vte_info.have_vte /* not disabled on the cmdline */)
+ if (vte_info.load_vte && vte_info.load_vte_cmdline /* not disabled on the cmdline */)
{
StashGroup *group;
struct passwd *pw = getpwuid(getuid());
Modified: src/libmain.c
6 lines changed, 2 insertions(+), 4 deletions(-)
===================================================================
@@ -877,14 +877,12 @@ static void load_session_project_file(void)
static void load_settings(void)
{
#ifdef HAVE_VTE
- /* initially assume we'll have VTE unless it's disabled by cmdline, to allow configuration
- * loading to be notified about disabled VTE on the cmdline */
- vte_info.have_vte = !no_vte;
+ vte_info.load_vte_cmdline = !no_vte;
#endif
configuration_load();
/* let cmdline options overwrite configuration settings */
#ifdef HAVE_VTE
- vte_info.have_vte = (no_vte) ? FALSE : vte_info.load_vte;
+ vte_info.have_vte = vte_info.load_vte && vte_info.load_vte_cmdline;
#endif
if (no_msgwin)
ui_prefs.msgwindow_visible = FALSE;
Modified: src/vte.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -56,7 +56,7 @@
#include <errno.h>
-VteInfo vte_info;
+VteInfo vte_info = { FALSE, FALSE, FALSE, NULL, NULL };
VteConfig *vc;
static pid_t pid = 0;
Modified: src/vte.h
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -31,8 +31,9 @@ G_BEGIN_DECLS
typedef struct
{
- gboolean load_vte; /* this is the preference, NOT the current instance VTE state */
- gboolean have_vte; /* use this field to check if the current instance has VTE */
+ gboolean load_vte; /* this is the preference, NOT the current instance VTE state */
+ gboolean load_vte_cmdline; /* this is the command line option */
+ gboolean have_vte; /* use this field to check if the current instance has VTE */
gchar *lib_vte;
gchar *dir;
} VteInfo;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list