summaryrefslogtreecommitdiff
path: root/libgupnp-dlna/gupnp-dlna-metadata-backend.c
diff options
context:
space:
mode:
authorMark Ryan <mark.d.ryan@intel.com>2013-09-11 14:30:32 +0200
committerJussi Kukkonen <jussi.kukkonen@intel.com>2013-11-26 11:12:38 +0200
commitca60c81123740b602424e59d9a2eaf9c2ab8c31a (patch)
tree7609d5e9920c9072255eab2b6e1db8d3130db329 /libgupnp-dlna/gupnp-dlna-metadata-backend.c
parentc460839c00c5b2540d464f3479d3c532351c2398 (diff)
downloadgupnp-dlna-ca60c81123740b602424e59d9a2eaf9c2ab8c31a.tar.gz
Fix hang if no backends are available
This patch prevents gupnp-dlna from hanging when no meta data extracting backends are available. The problem occurs as the existing code passes a value of 0 into g_once_init_leave if a backend cannot be loaded. You're not allowed to do this and as a result load_metadata_backend hangs the next time it is called. The patch fixes the problem by using 1 and 2 to indicate failure and success, respectively. https://bugzilla.gnome.org/show_bug.cgi?id=707909
Diffstat (limited to 'libgupnp-dlna/gupnp-dlna-metadata-backend.c')
-rw-r--r--libgupnp-dlna/gupnp-dlna-metadata-backend.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libgupnp-dlna/gupnp-dlna-metadata-backend.c b/libgupnp-dlna/gupnp-dlna-metadata-backend.c
index a19b155..e0754cd 100644
--- a/libgupnp-dlna/gupnp-dlna-metadata-backend.c
+++ b/libgupnp-dlna/gupnp-dlna-metadata-backend.c
@@ -45,7 +45,7 @@ load_metadata_backend (void)
GModule *module;
gchar *module_path;
gpointer get_default_extractor = NULL;
- gsize loaded = 0;
+ gsize loaded = 1;
if (!backend)
backend = GUPNP_DLNA_DEFAULT_METADATA_BACKEND;
@@ -82,7 +82,7 @@ load_metadata_backend (void)
metadata_backend.module = module;
metadata_backend.get_default_extractor = get_default_extractor;
module = NULL;
- loaded = 1;
+ loaded = 2;
fail:
g_free (module_path);
if (module)
@@ -91,7 +91,7 @@ load_metadata_backend (void)
g_once_init_leave (&backend_chosen, loaded);
}
- return (backend_chosen != 0);
+ return (backend_chosen == 2);
}
GUPnPDLNAMetadataExtractor *