7d558fd06a
last update. This prevents crashes when opening URLs (i.e. by selecting "Open in browser" in the gnome-terminal context menu)
71 lines
1.8 KiB
Text
71 lines
1.8 KiB
Text
$NetBSD: patch-ay,v 1.3 2002/05/05 22:52:12 martin Exp $
|
|
|
|
--- libgnome/gnome-url.c.orig Thu Jan 10 23:03:17 2002
|
|
+++ libgnome/gnome-url.c Mon May 6 00:06:38 2002
|
|
@@ -80,6 +80,8 @@
|
|
return default_handler;
|
|
}
|
|
|
|
+static int gnome_url_show_with_handler (const gchar *url, const gchar *template);
|
|
+
|
|
/**
|
|
* gnome_url_show
|
|
* @url: URL to show
|
|
@@ -105,11 +107,9 @@
|
|
void
|
|
gnome_url_show(const gchar *url)
|
|
{
|
|
- gint i;
|
|
gchar *pos, *template;
|
|
gboolean free_template = FALSE;
|
|
- int argc;
|
|
- char **argv;
|
|
+ int status;
|
|
|
|
g_return_if_fail (url != NULL);
|
|
pos = strchr (url, ':');
|
|
@@ -135,12 +135,26 @@
|
|
} else /* no : ? -- this shouldn't happen. Use default handler */
|
|
template = gnome_url_default_handler (NULL);
|
|
|
|
+ status = gnome_url_show_with_handler (url, template);
|
|
+ if (status == -1 && free_template)
|
|
+ gnome_url_show_with_handler (url, gnome_url_default_handler (NULL));
|
|
+
|
|
+ if (free_template)
|
|
+ g_free (template);
|
|
+}
|
|
+
|
|
+static int
|
|
+gnome_url_show_with_handler (const gchar *url, const gchar *template)
|
|
+{
|
|
+ int argc, i, status;
|
|
+ char **argv;
|
|
+
|
|
/* we use a popt function as it does exactly what we want to do and
|
|
gnome already uses popt */
|
|
if(poptParseArgvString(template, &argc, &argv) != 0) {
|
|
/* can't parse */
|
|
g_warning("Parse error of '%s'", template);
|
|
- return;
|
|
+ return -1;
|
|
}
|
|
|
|
/* we can just replace the entry in the array since the
|
|
@@ -154,13 +168,12 @@
|
|
|
|
/* use execute async, and not the shell, shell is evil and a
|
|
* security hole */
|
|
- gnome_execute_async (NULL, argc, argv);
|
|
-
|
|
- if (free_template)
|
|
- g_free (template);
|
|
+ status = gnome_execute_async (NULL, argc, argv);
|
|
|
|
/* the way the poptParseArgvString works is that the entire thing
|
|
* is allocated as one buffer, so just free will suffice, also
|
|
* it must be free and not g_free */
|
|
free(argv);
|
|
+
|
|
+ return status;
|
|
}
|