diff options
author | Jens Georg <mail@jensge.org> | 2015-07-01 00:26:55 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2015-07-01 00:50:47 +0200 |
commit | 9007c6920d162c6f53316dc14390358d9a0473cd (patch) | |
tree | 3a86d3cd7b456dbb0709ee6c491bb798ea15fb66 | |
parent | 7b174a5ba264af10f4910cf26b76f00d3cf850cc (diff) | |
download | gupnp-dlna-9007c6920d162c6f53316dc14390358d9a0473cd.tar.gz |
gupnp-dlna-info: Exit properly in async mode
If no files could be added to the guesser, it would be stuck in the main loop
forever.
Signed-off-by: Jens Georg <mail@jensge.org>
https://bugzilla.gnome.org/show_bug.cgi?id=751634
-rw-r--r-- | tools/gupnp-dlna-info.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/gupnp-dlna-info.c b/tools/gupnp-dlna-info.c index 7fc0fb4..6fabafa 100644 --- a/tools/gupnp-dlna-info.c +++ b/tools/gupnp-dlna-info.c @@ -51,6 +51,7 @@ typedef struct GUPnPDLNAProfileGuesser *guesser; int argc; char **argv; + GMainLoop *ml; } PrivStruct; static void @@ -212,6 +213,11 @@ async_idle_loop (PrivStruct *ps) for (iter = 1; iter < ps->argc; iter++) process_file (ps->guesser, ps->argv[iter]); + /* No files added to queue, exit program */ + if (files_to_guess == 0) { + g_main_loop_quit (ps->ml); + } + return FALSE; } @@ -266,6 +272,10 @@ main (int argc, guesser = gupnp_dlna_profile_guesser_new (relaxed_mode, extended_mode); + if (guesser == NULL) { + g_print ("Failed to create meta-data guesser\n"); + exit (1); + } if (async == FALSE) { gint iter; @@ -279,6 +289,7 @@ main (int argc, ps->guesser = guesser; ps->argc = argc; ps->argv = argv; + ps->ml = ml; g_idle_add ((GSourceFunc) async_idle_loop, ps); |