[rygel] core: Always wait for update first



commit 80737a44c044f1e1df402d0f18a1d98d2e58049d
Author: Jens Georg <mail jensge org>
Date:   Fri May 6 11:46:11 2011 +0200

    core: Always wait for update first
    
    Try to avoid a race where the HTTP post gets signalled by the wrong change.

 src/rygel/rygel-item-creator.vala |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 8abfaaf..deaf737 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -326,17 +326,6 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
         MediaItem item = null;
 
         while (item == null) {
-            try {
-                item = (yield container.find_object (this.item.id,
-                                                     this.cancellable))
-                       as MediaItem;
-            } catch (Error error) {
-                warning ("Error from container '%s' on trying to find newly " +
-                         "added child item '%s' in it",
-                         container.id,
-                         this.item.id);
-            }
-
             if (item == null) {
                 var id = container.container_updated.connect ((container) => {
                     this.wait_for_item.callback ();
@@ -356,6 +345,18 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
 
                 container.disconnect (id);
 
+                try {
+                    item = (yield container.find_object (this.item.id,
+                                                         this.cancellable))
+                                        as MediaItem;
+                } catch (Error error) {
+                    warning ("Error from container '%s' on trying to find newly " +
+                            "added child item '%s' in it",
+                            container.id,
+                            this.item.id);
+                }
+
+
                 if (timeout != 0) {
                     Source.remove (timeout);
                 } else {



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