Fix Crashing on Mate-Terminal when proxy is set

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackware-id.org>
This commit is contained in:
Willy Sudiarto Raharjo 2013-04-09 08:59:13 +07:00
parent 7a386ad0c7
commit 775acc9fe2
2 changed files with 169 additions and 1 deletions

View file

@ -3,6 +3,7 @@
# Slackware build script for mate-terminal
# Copyright 2013 Chess Griffin <chess.griffin@gmail.com> Raleigh, NC
# Copyright 2013 Willy Sudiarto Raharjo <willysr@slackware-id.org>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -24,7 +25,7 @@
PRGNAM=mate-terminal
VERSION=${VERSION:-1.6.0}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_msb}
if [ -z "$ARCH" ]; then
@ -75,6 +76,10 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Upstream patch
# http://git.mate-desktop.org/mate-terminal/commit/?id=14885e3eee9f3b7b6611e50ef92a87a7e36f469a
patch -p1 < $CWD/proxy-env.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./autogen.sh \

View file

@ -0,0 +1,163 @@
From 14885e3eee9f3b7b6611e50ef92a87a7e36f469a Mon Sep 17 00:00:00 2001
From: Scott Balneaves <sbalneav@mate-desktop.org>
Date: Mon, 08 Apr 2013 20:44:59 +0000
Subject: Fix crashing on start with proxy set, properly set all proxy env vars
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 049add3..d64f876 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1406,7 +1406,7 @@ get_child_environment (TerminalScreen *screen,
list_schemas = g_settings_list_schemas();
schema_exists = FALSE;
for (i = 0; list_schemas[i] != NULL; i++) {
- if (g_strcmp0 (list_schemas[i], "org.gnome.system.proxy") == 0)
+ if (g_strcmp0 (list_schemas[i], CONF_PROXY_SCHEMA) == 0)
{
schema_exists = TRUE;
break;
diff --git a/src/terminal-util.c b/src/terminal-util.c
index 421169d..0384366 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -593,15 +593,12 @@ setup_http_proxy_env (GHashTable *env_table,
{
gchar *host;
gint port;
- GSList *ignore;
-
- if (!g_settings_get_boolean (settings_http, "use-http-proxy"))
- return;
host = gsettings_get_string (settings_http, "host");
port = g_settings_get_int (settings_http, "port");
if (host && port)
{
+
GString *buf = g_string_sized_new (64);
g_string_append (buf, "http://");
@@ -628,7 +625,15 @@ setup_http_proxy_env (GHashTable *env_table,
}
g_free (host);
- gchar **ignore_strv = g_settings_get_strv (settings_http, "ignore-hosts");
+}
+
+static void
+setup_ignore_host_env (GHashTable *env_table,
+ GSettings *settings)
+{
+ GSList *ignore;
+ gchar **ignore_strv = g_settings_get_strv (settings, "ignore-hosts");
+
ignore = terminal_gsettings_strv_to_gslist (ignore_strv);
if (ignore)
{
@@ -654,13 +659,13 @@ setup_http_proxy_env (GHashTable *env_table,
static void
setup_https_proxy_env (GHashTable *env_table,
- GSettings *settings)
+ GSettings *settings_https)
{
gchar *host;
gint port;
- host = gsettings_get_string (settings, "secure-host");
- port = g_settings_get_int (settings, "secure-port");
+ host = gsettings_get_string (settings_https, "host");
+ port = g_settings_get_int (settings_https, "port");
if (host && port)
{
char *proxy;
@@ -673,13 +678,13 @@ setup_https_proxy_env (GHashTable *env_table,
static void
setup_ftp_proxy_env (GHashTable *env_table,
- GSettings *settings)
+ GSettings *settings_ftp)
{
gchar *host;
gint port;
- host = gsettings_get_string (settings, "ftp-host");
- port = g_settings_get_int (settings, "ftp-port");
+ host = gsettings_get_string (settings_ftp, "host");
+ port = g_settings_get_int (settings_ftp, "port");
if (host && port)
{
char *proxy;
@@ -692,13 +697,13 @@ setup_ftp_proxy_env (GHashTable *env_table,
static void
setup_socks_proxy_env (GHashTable *env_table,
- GSettings *settings)
+ GSettings *settings_socks)
{
gchar *host;
gint port;
- host = gsettings_get_string (settings, "socks-host");
- port = g_settings_get_int (settings, "socks-port");
+ host = gsettings_get_string (settings_socks, "host");
+ port = g_settings_get_int (settings_socks, "port");
if (host && port)
{
char *proxy;
@@ -736,19 +741,21 @@ void
terminal_util_add_proxy_env (GHashTable *env_table)
{
char *proxymode;
-
- GSettings *settings, *settings_http;
- settings = g_settings_new (CONF_PROXY_SCHEMA);
- settings_http = g_settings_new (CONF_HTTP_PROXY_SCHEMA);
+ GSettings *settings = g_settings_new (CONF_PROXY_SCHEMA);
+ GSettings *settings_http = g_settings_new (CONF_HTTP_PROXY_SCHEMA);
+ GSettings *settings_https = g_settings_new (CONF_HTTPS_PROXY_SCHEMA);
+ GSettings *settings_ftp = g_settings_new (CONF_FTP_PROXY_SCHEMA);
+ GSettings *settings_socks = g_settings_new (CONF_SOCKS_PROXY_SCHEMA);
/* If mode is not manual, nothing to set */
proxymode = gsettings_get_string (settings, "mode");
if (proxymode && 0 == strcmp (proxymode, "manual"))
{
setup_http_proxy_env (env_table, settings_http);
- setup_https_proxy_env (env_table, settings);
- setup_ftp_proxy_env (env_table, settings);
- setup_socks_proxy_env (env_table, settings);
+ setup_ignore_host_env (env_table, settings);
+ setup_https_proxy_env (env_table, settings_https);
+ setup_ftp_proxy_env (env_table, settings_ftp);
+ setup_socks_proxy_env (env_table, settings_socks);
}
else if (proxymode && 0 == strcmp (proxymode, "auto"))
{
@@ -758,6 +765,9 @@ terminal_util_add_proxy_env (GHashTable *env_table)
g_free (proxymode);
g_object_unref (settings);
g_object_unref (settings_http);
+ g_object_unref (settings_https);
+ g_object_unref (settings_ftp);
+ g_object_unref (settings_socks);
}
/* Bidirectional object/widget binding */
diff --git a/src/terminal-util.h b/src/terminal-util.h
index 1e54388..9cf7f85 100644
--- a/src/terminal-util.h
+++ b/src/terminal-util.h
@@ -29,6 +29,9 @@ G_BEGIN_DECLS
#define CONF_PROXY_SCHEMA "org.gnome.system.proxy"
#define CONF_HTTP_PROXY_SCHEMA "org.gnome.system.proxy.http"
+#define CONF_HTTPS_PROXY_SCHEMA "org.gnome.system.proxy.https"
+#define CONF_FTP_PROXY_SCHEMA "org.gnome.system.proxy.ftp"
+#define CONF_SOCKS_PROXY_SCHEMA "org.gnome.system.proxy.socks"
void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
--
cgit