- Backport fixes from cvs:

- Fix crash on shutdown (gnome bug 347470)
- Import gtk+ fixes to xdgmime
f38
Alexander Larsson 19 years ago
parent 93d1acb4ee
commit 60c889e5a6

@ -0,0 +1,421 @@
Index: libgnomevfs/xdgmime.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmime.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- libgnomevfs/xdgmime.c 1 Dec 2005 19:32:02 -0000 1.13
+++ libgnomevfs/xdgmime.c 13 Sep 2006 09:23:36 -0000 1.14
@@ -60,7 +60,7 @@ static XdgCallbackList *callback_list =
XdgMimeCache **_caches = NULL;
static int n_caches = 0;
-const char *xdg_mime_type_unknown = "application/octet-stream";
+const char xdg_mime_type_unknown[] = "application/octet-stream";
enum
@@ -281,7 +281,8 @@ xdg_run_command_on_dirs (XdgDirectoryFun
* FIXME: This doesn't protect against permission changes.
*/
static int
-xdg_check_file (const char *file_path)
+xdg_check_file (const char *file_path,
+ int *exists)
{
struct stat st;
@@ -290,6 +291,9 @@ xdg_check_file (const char *file_path)
{
XdgDirTimeList *list;
+ if (exists)
+ *exists = TRUE;
+
for (list = dir_time_list; list; list = list->next)
{
if (! strcmp (list->directory_name, file_path) &&
@@ -306,6 +310,9 @@ xdg_check_file (const char *file_path)
return TRUE;
}
+ if (exists)
+ *exists = FALSE;
+
return FALSE;
}
@@ -313,26 +320,30 @@ static int
xdg_check_dir (const char *directory,
int *invalid_dir_list)
{
- int invalid;
+ int invalid, exists;
char *file_name;
assert (directory != NULL);
- /* Check the globs file */
- file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/globs");
- invalid = xdg_check_file (file_name);
+ /* Check the mime.cache file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/mime.cache") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/mime.cache");
+ invalid = xdg_check_file (file_name, &exists);
free (file_name);
if (invalid)
{
*invalid_dir_list = TRUE;
return TRUE;
}
+ else if (exists)
+ {
+ return FALSE;
+ }
- /* Check the magic file */
- file_name = malloc (strlen (directory) + strlen ("/mime/magic") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/magic");
- invalid = xdg_check_file (file_name);
+ /* Check the globs file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/globs");
+ invalid = xdg_check_file (file_name, NULL);
free (file_name);
if (invalid)
{
@@ -340,10 +351,10 @@ xdg_check_dir (const char *directory,
return TRUE;
}
- /* Check the mime.cache file */
- file_name = malloc (strlen (directory) + strlen ("/mime/mime.cache") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/mime.cache");
- invalid = xdg_check_file (file_name);
+ /* Check the magic file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/magic") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/magic");
+ invalid = xdg_check_file (file_name, NULL);
free (file_name);
if (invalid)
{
@@ -584,6 +595,17 @@ xdg_mime_shutdown (void)
parent_list = NULL;
}
+ if (_caches)
+ {
+ int i;
+
+ for (i = 0; i < n_caches; i++)
+ _xdg_mime_cache_unref (_caches[i]);
+ free (_caches);
+ _caches = NULL;
+ n_caches = 0;
+ }
+
for (list = callback_list; list; list = list->next)
(list->callback) (list->data);
@@ -602,12 +624,10 @@ xdg_mime_get_max_buffer_extents (void)
}
const char *
-xdg_mime_unalias_mime_type (const char *mime_type)
+_xdg_mime_unalias_mime_type (const char *mime_type)
{
const char *lookup;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_unalias_mime_type (mime_type);
@@ -617,16 +637,22 @@ xdg_mime_unalias_mime_type (const char *
return mime_type;
}
+const char *
+xdg_mime_unalias_mime_type (const char *mime_type)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_unalias_mime_type (mime_type);
+}
+
int
-xdg_mime_mime_type_equal (const char *mime_a,
- const char *mime_b)
+_xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
{
const char *unalias_a, *unalias_b;
- xdg_mime_init ();
-
- unalias_a = xdg_mime_unalias_mime_type (mime_a);
- unalias_b = xdg_mime_unalias_mime_type (mime_b);
+ unalias_a = _xdg_mime_unalias_mime_type (mime_a);
+ unalias_b = _xdg_mime_unalias_mime_type (mime_b);
if (strcmp (unalias_a, unalias_b) == 0)
return 1;
@@ -635,6 +661,15 @@ xdg_mime_mime_type_equal (const char *mi
}
int
+xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_equal (mime_a, mime_b);
+}
+
+int
xdg_mime_media_type_equal (const char *mime_a,
const char *mime_b)
{
@@ -650,7 +685,7 @@ xdg_mime_media_type_equal (const char *m
return 0;
}
-#if 0
+#if 1
static int
xdg_mime_is_super_type (const char *mime)
{
@@ -668,24 +703,22 @@ xdg_mime_is_super_type (const char *mime
#endif
int
-xdg_mime_mime_type_subclass (const char *mime,
- const char *base)
+_xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
{
const char *umime, *ubase;
const char **parents;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_mime_type_subclass (mime, base);
- umime = xdg_mime_unalias_mime_type (mime);
- ubase = xdg_mime_unalias_mime_type (base);
+ umime = _xdg_mime_unalias_mime_type (mime);
+ ubase = _xdg_mime_unalias_mime_type (base);
if (strcmp (umime, ubase) == 0)
return 1;
-#if 0
+#if 1
/* Handle supertypes */
if (xdg_mime_is_super_type (ubase) &&
xdg_mime_media_type_equal (umime, ubase))
@@ -703,13 +736,22 @@ xdg_mime_mime_type_subclass (const char
parents = _xdg_mime_parent_list_lookup (parent_list, umime);
for (; parents && *parents; parents++)
{
- if (xdg_mime_mime_type_subclass (*parents, ubase))
+ if (_xdg_mime_mime_type_subclass (*parents, ubase))
return 1;
}
return 0;
}
+int
+xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_subclass (mime, base);
+}
+
char **
xdg_mime_list_mime_parents (const char *mime)
{
@@ -741,7 +783,7 @@ xdg_mime_get_mime_parents (const char *m
xdg_mime_init ();
- umime = xdg_mime_unalias_mime_type (mime);
+ umime = _xdg_mime_unalias_mime_type (mime);
return _xdg_mime_parent_list_lookup (parent_list, umime);
}
Index: libgnomevfs/xdgmime.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmime.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- libgnomevfs/xdgmime.h 19 Oct 2005 12:40:26 -0000 1.10
+++ libgnomevfs/xdgmime.h 13 Sep 2006 09:23:36 -0000 1.11
@@ -59,12 +59,13 @@ typedef void (*XdgMimeDestroy) (void *u
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
+#define xdg_mime_dump XDG_ENTRY(dump)
#define xdg_mime_register_reload_callback XDG_ENTRY(register_reload_callback)
#define xdg_mime_remove_callback XDG_ENTRY(remove_callback)
#define xdg_mime_type_unknown XDG_ENTRY(type_unknown)
#endif
-extern const char *xdg_mime_type_unknown;
+extern const char xdg_mime_type_unknown[];
#define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
const char *xdg_mime_get_mime_type_for_data (const void *data,
@@ -95,8 +96,17 @@ int xdg_mime_register_reload_ca
XdgMimeDestroy destroy);
void xdg_mime_remove_callback (int callback_id);
+ /* Private versions of functions that don't call xdg_mime_init () */
+int _xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b);
+int _xdg_mime_media_type_equal (const char *mime_a,
+ const char *mime_b);
+int _xdg_mime_mime_type_subclass (const char *mime,
+ const char *base);
+const char *_xdg_mime_unalias_mime_type (const char *mime);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
-
#endif /* __XDG_MIME_H__ */
Index: libgnomevfs/xdgmimeglob.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmimeglob.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- libgnomevfs/xdgmimeglob.c 2 Mar 2006 17:13:50 -0000 1.12
+++ libgnomevfs/xdgmimeglob.c 13 Sep 2006 09:23:36 -0000 1.13
@@ -263,7 +263,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashN
{
child = _xdg_glob_hash_node_new ();
child->character = '\000';
- child->mime_type = strdup (mime_type);
+ child->mime_type = mime_type;
child->child = NULL;
child->next = node->child;
node->child = child;
@@ -272,7 +272,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashN
}
else
{
- node->mime_type = strdup (mime_type);
+ node->mime_type = mime_type;
}
}
else
@@ -308,11 +308,13 @@ _xdg_glob_hash_node_lookup_file_name (Xd
if (*file_name == '\000')
{
n = 0;
- mime_types[n++] = node->mime_type;
+ if (node->mime_type)
+ mime_types[n++] = node->mime_type;
node = node->child;
while (n < n_mime_types && node && node->character == 0)
{
- mime_types[n++] = node->mime_type;
+ if (node->mime_type)
+ mime_types[n++] = node->mime_type;
node = node->next;
}
}
@@ -475,7 +477,7 @@ _xdg_glob_hash_append_glob (XdgGlobHash
glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type));
break;
case XDG_GLOB_SIMPLE:
- glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, mime_type);
+ glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, strdup (mime_type));
break;
case XDG_GLOB_FULL:
glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type));
Index: libgnomevfs/xdgmimemagic.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmimemagic.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- libgnomevfs/xdgmimemagic.c 13 Jul 2006 19:02:47 -0000 1.16
+++ libgnomevfs/xdgmimemagic.c 13 Sep 2006 09:23:36 -0000 1.17
@@ -671,7 +671,7 @@ _xdg_mime_magic_lookup_data (XdgMimeMagi
if (_xdg_mime_magic_match_compare_to_data (match, data, len))
{
if (!had_match || match->priority > priority ||
- (mime_type != NULL && xdg_mime_mime_type_subclass (match->mime_type, mime_type)))
+ (mime_type != NULL && _xdg_mime_mime_type_subclass (match->mime_type, mime_type)))
{
mime_type = match->mime_type;
priority = match->priority;
@@ -688,7 +688,7 @@ _xdg_mime_magic_lookup_data (XdgMimeMagi
for (n = 0; n < n_mime_types; n++)
{
if (mime_types[n] &&
- xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
+ _xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
mime_types[n] = NULL;
}
}
Index: modules/http-neon-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -p -r1.39 -r1.40
--- modules/http-neon-method.c 1 Sep 2006 19:28:27 -0000 1.39
+++ modules/http-neon-method.c 15 Sep 2006 19:31:00 -0000 1.40
@@ -400,6 +400,7 @@ G_LOCK_DEFINE (auth_cache);
static GHashTable *auth_cache_basic;
static GHashTable *auth_cache_proxy;
static guint cleanup_id;
+static guint module_refcount = 0;
typedef struct {
@@ -3331,20 +3332,24 @@ static GnomeVFSMethod http_method = {
GnomeVFSMethod *
vfs_module_init (const char *method_name, const char *args)
{
- proxy_init ();
- /* ne_debug_init (stdout, 0xfffe); */
- neon_session_pool_init ();
- http_auth_cache_init ();
- quick_allow_lookup_init ();
-
+ if (module_refcount++ == 0) {
+ proxy_init ();
+ /* ne_debug_init (stdout, 0xfffe); */
+ neon_session_pool_init ();
+ http_auth_cache_init ();
+ quick_allow_lookup_init ();
+ }
+
return &http_method;
}
void
vfs_module_shutdown (GnomeVFSMethod *method)
{
- quit_allow_lookup_destroy ();
- http_auth_cache_shutdown ();
- neon_session_pool_shutdown ();
- proxy_shutdown ();
+ if (--module_refcount == 0) {
+ quit_allow_lookup_destroy ();
+ http_auth_cache_shutdown ();
+ neon_session_pool_shutdown ();
+ proxy_shutdown ();
+ }
}

@ -13,7 +13,7 @@
Summary: The GNOME virtual file-system libraries
Name: gnome-vfs2
Version: 2.16.0
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPL
Group: System Environment/Libraries
Source0: gnome-vfs-%{version}.tar.bz2
@ -62,6 +62,9 @@ Patch4: gnome-vfs-2.15.1-use-sys-inotify.patch
# RH bug #197868
Patch6: gnome-vfs-2.15.91-mailto-command.patch
Patch7: gnome-vfs-2.16.0-cvs-backport.patch
%description
GNOME VFS is the GNOME virtual file system. It is the foundation of
the Nautilus file manager. It provides a modular architecture and
@ -111,6 +114,8 @@ shares (SMB) to applications using GNOME VFS.
%patch104 -p1 -b .browser_default
%patch201 -p0 -b .console
%patch7 -p0 -b .cvs-backport
%build
if pkg-config openssl ; then
@ -195,6 +200,11 @@ done
%config %{_sysconfdir}/gnome-vfs-2.0/modules/smb-module.conf
%changelog
* Tue Sep 19 2006 Alexander Larsson <alexl@redhat.com> - 2.16.0-2
- Backport fixes from cvs:
- Fix crash on shutdown (gnome bug 347470)
- Import gtk+ fixes to xdgmime
* Mon Sep 4 2006 Alexander Larsson <alexl@redhat.com> - 2.16.0-1
- update to 2.16.0

Loading…
Cancel
Save