diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-08-28 14:12:29 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-08-28 14:12:29 +0800 |
commit | 83bcd024ad735dfa369fa4506ac54bed4611dc58 (patch) | |
tree | 12a0fd5b27d683f4e0ca14e154830e82e4e673ca /devel/gnomevfs2/files | |
parent | a203cafa8f13e657422b8476bc88dab152f1cd63 (diff) | |
download | marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar.gz marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar.bz2 marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar.lz marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar.xz marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.tar.zst marcuscom-ports-83bcd024ad735dfa369fa4506ac54bed4611dc58.zip |
Lock down the xdgmime API a bit more to avoid reentrancy problems.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@4648 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel/gnomevfs2/files')
-rw-r--r-- | devel/gnomevfs2/files/patch-libgnomevfs_gnome-vfs-mime.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/devel/gnomevfs2/files/patch-libgnomevfs_gnome-vfs-mime.c b/devel/gnomevfs2/files/patch-libgnomevfs_gnome-vfs-mime.c new file mode 100644 index 000000000..693ade8b7 --- /dev/null +++ b/devel/gnomevfs2/files/patch-libgnomevfs_gnome-vfs-mime.c @@ -0,0 +1,57 @@ +--- libgnomevfs/gnome-vfs-mime.c.orig Sun Aug 28 02:00:22 2005 ++++ libgnomevfs/gnome-vfs-mime.c Sun Aug 28 02:07:11 2005 +@@ -211,7 +211,7 @@ _gnome_vfs_get_mime_type_internal (Gnome + + if (buffer != NULL) { + result = _gnome_vfs_read_mime_from_buffer (buffer); +- ++ + if (result != NULL && result != XDG_MIME_TYPE_UNKNOWN) { + + if ((strcmp (result, "application/x-ole-storage") == 0) || +@@ -229,9 +229,13 @@ _gnome_vfs_get_mime_type_internal (Gnome + result = fn_result; + } + +- } else if (fn_result && fn_result != XDG_MIME_TYPE_UNKNOWN && ++ } else { ++ G_LOCK (mime_mutex); ++ if (fn_result && fn_result != XDG_MIME_TYPE_UNKNOWN && + xdg_mime_mime_type_subclass (fn_result, result)) { +- result = fn_result; ++ result = fn_result; ++ } ++ G_UNLOCK (mime_mutex); + } + + return result; +@@ -243,18 +247,27 @@ _gnome_vfs_get_mime_type_internal (Gnome + * accurate source of type information BUT _only_ if + * the extension is a subtype of text/plain. + */ ++ G_LOCK (mime_mutex); + if ((fn_result != NULL) && (fn_result != XDG_MIME_TYPE_UNKNOWN) && + xdg_mime_mime_type_subclass (fn_result, "text/plain")) { ++ G_UNLOCK (mime_mutex); + return fn_result; + } + + /* Didn't find an extension match, assume plain text. */ ++ G_UNLOCK (mime_mutex); + return "text/plain"; + +- } else if (_gnome_vfs_sniff_buffer_looks_like_mp3 (buffer)) { +- return "audio/mpeg"; ++ } else { ++ G_LOCK (mime_mutex); ++ if (_gnome_vfs_sniff_buffer_looks_like_mp3 (buffer)) { ++ G_UNLOCK (mime_mutex); ++ return "audio/mpeg"; ++ } ++ G_UNLOCK (mime_mutex); + } + } ++ + } + + if (use_suffix && |