[totem] Bug 579716 – totem-plugin-viewer crashed with SIGSEGV in strchr()
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Subject: [totem] Bug 579716 – totem-plugin-viewer crashed with SIGSEGV in strchr()
- Date: Wed, 22 Apr 2009 09:54:18 -0400 (EDT)
commit 0a64e71e77d3b5da71f6ea43e87c9adba6fcf6a2
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 22 14:53:42 2009 +0100
Bug 579716 â?? totem-plugin-viewer crashed with SIGSEGV in strchr()
2009-04-22 Bastien Nocera <hadess hadess net>
* browser-plugin/totem-plugin-viewer.c (totem_embedded_set_uri):
* configure.in: Use the new URI resolution code in totem-pl-parser
and fix crasher when opening a video at the root of a webserver
(Closes: #579716)
---
ChangeLog | 7 +++
browser-plugin/totem-plugin-viewer.c | 94 ++++------------------------------
configure.in | 2 +-
3 files changed, 19 insertions(+), 84 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6e78928..c3a31d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-22 Bastien Nocera <hadess hadess net>
+
+ * browser-plugin/totem-plugin-viewer.c (totem_embedded_set_uri):
+ * configure.in: Use the new URI resolution code in totem-pl-parser
+ and fix crasher when opening a video at the root of a webserver
+ (Closes: #579716)
+
2009-04-21 Bastien Nocera <hadess hadess net>
* data/totem.1: Remove out-dated options from the man page
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 494d91f..64f6a7a 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -58,6 +58,10 @@ GtkWidget *totem_statusbar_create (void);
GtkWidget *totem_volume_create (void);
GtkWidget *totem_pp_create (void);
+/* Private function in totem-pl-parser, not for use
+ * by anyone but us */
+char * totem_pl_parser_resolve_uri (GFile *base_gfile, const char *relative_uri);
+
#define VOLUME_DOWN_OFFSET (-0.08)
#define VOLUME_UP_OFFSET (0.08)
#define MINIMUM_VIDEO_SIZE 150
@@ -661,102 +665,26 @@ totem_embedded_launch_player (TotemEmbedded *embedded,
return result;
}
-static char *
-relative_uri_remove_query (const char *uri, char **query)
-{
- char *qmark;
-
- /* Look for '?' */
- qmark = strrchr (uri, '?');
- if (qmark == NULL)
- return NULL;
-
- *query = g_strdup (qmark);
- return g_strndup (uri, qmark - uri);
-}
-
-static char *
-resolve_uri (const char *base_uri,
- const char *relative_uri)
-{
- char *uri, *scheme, *query, *new_relative_uri;
- GFile *base_gfile, *base_parent_gfile, *resolved_gfile;
-
- if (!relative_uri)
- return g_strdup (base_uri);
-
- if (!base_uri)
- return g_strdup (relative_uri);
-
- /* If |relative_uri| has a scheme, it's a full URI, just return it */
- scheme = g_uri_parse_scheme (relative_uri);
- if (scheme) {
- g_free (scheme);
- return g_strdup (relative_uri);
- }
-
- base_gfile = g_file_new_for_uri (base_uri);
- base_parent_gfile = g_file_get_parent (base_gfile);
- if (!base_parent_gfile) {
- g_print ("Base URI %s has no parent!\n", base_uri);
- g_object_unref (base_gfile);
- return NULL;
- }
- g_object_unref (base_gfile);
-
- query = NULL;
- new_relative_uri = relative_uri_remove_query (relative_uri, &query);
-
- if (new_relative_uri) {
- char *tmpuri;
-
- resolved_gfile = g_file_resolve_relative_path (base_parent_gfile, new_relative_uri);
- g_object_unref (base_parent_gfile);
- if (!resolved_gfile) {
- g_warning ("Failed to resolve relative URI '%s' against base '%s'\n", relative_uri, base_uri);
- g_free (new_relative_uri);
- g_free (query);
- return NULL;
- }
-
- tmpuri = g_file_get_uri (resolved_gfile);
- g_object_unref (resolved_gfile);
- uri = g_strdup_printf ("%s%s", tmpuri, query);
-
- g_free (tmpuri);
- g_free (new_relative_uri);
- g_free (query);
-
- return uri;
- } else {
- resolved_gfile = g_file_resolve_relative_path (base_parent_gfile, relative_uri);
- g_object_unref (base_parent_gfile);
- if (!resolved_gfile) {
- g_warning ("Failed to resolve relative URI '%s' against base '%s'\n", relative_uri, base_uri);
- return NULL;
- }
-
- uri = g_file_get_uri (resolved_gfile);
- g_object_unref (resolved_gfile);
-
- return uri;
- }
-}
-
static void
totem_embedded_set_uri (TotemEmbedded *emb,
const char *uri,
const char *base_uri,
gboolean is_browser_stream)
{
+ GFile *base_gfile;
char *old_uri, *old_base, *old_href;
+ base_gfile = NULL;
old_uri = emb->current_uri;
old_base = emb->base_uri;
old_href = emb->href_uri;
emb->base_uri = g_strdup (base_uri);
- emb->current_uri = resolve_uri (base_uri, uri);
+ if (base_uri)
+ base_gfile = g_file_new_for_uri (base_uri);
+ emb->current_uri = totem_pl_parser_resolve_uri (base_gfile, uri);
+ if (base_gfile)
+ g_object_unref (base_gfile);
emb->is_browser_stream = (is_browser_stream != FALSE);
emb->href_uri = NULL;
diff --git a/configure.in b/configure.in
index 51db0cb..16dc7e7 100644
--- a/configure.in
+++ b/configure.in
@@ -35,7 +35,7 @@ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
# Requirements
GLIB_REQS=2.13.4
GTK_REQS=2.16.0
-TOTEM_PLPARSER_REQS=2.23.91
+TOTEM_PLPARSER_REQS=2.27.0
GNOMEICON_REQS=2.15.90
DBUS_REQS=0.61
VALA_REQS=0.1.6
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]