[rygel] media-export: Avoid direct recursion



commit 319f020d01def80bf8c5c977643f1a3ade8296ac
Author: Jens Georg <mail jensge org>
Date:   Sat May 15 00:49:47 2010 +0200

    media-export: Avoid direct recursion
    
    extract_next was calling itself in error-case. Tunnelling via idle-loop
    is the safer option.

 .../rygel-media-export-metadata-extractor.vala     |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
index 2d9dba3..0c57036 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -181,8 +181,8 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         }
 
         if (this.file_queue.get_length () > 0) {
+            var item = this.file_queue.peek_head ();
             try {
-                var item = this.file_queue.peek_head ();
                 debug (_("Scheduling file %s for metadata extraction"),
                        item.get_uri ());
                 this.extract_mime_and_size ();
@@ -205,8 +205,19 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
                     });
                 }
             } catch (Error error) {
+                // Translators: first parameter is file uri, second is error
+                // message
+                warning (_("Failed to extract metadata from %s: %s"),
+                         item.get_uri (),
+                         error.message);
+
                 // on error just move to the next uri in queue
-                this.extract_next ();
+                Idle.add (() => {
+                    this.error (this.file_queue.pop_head (), error);
+                    this.extract_next ();
+
+                    return false;
+                });
             }
         }
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]