[rygel] server: Use custom equal function for updated_containers array.



commit 046d93bcc847d37fb9493c070e012e64650d30c0
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Tue Feb 26 14:04:35 2013 +0100

    server: Use custom equal function for updated_containers array.
    
    Default equal function was simply comparing pointers, which is not
    enough in this case. MediaExport plugin creates temporary
    MediaContainer objects being virtual containers, so it is possible to
    happen that we store such container in updated_containers array and
    then later receive another one with the same id. Obviously new object
    has different address than old one, so it was inserted into array as
    well. It ended up with ContainerUpdateIDs having several entries with
    the same id.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694019

 src/librygel-server/rygel-content-directory.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-server/rygel-content-directory.vala 
b/src/librygel-server/rygel-content-directory.vala
index 435c577..8f9048d 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -94,7 +94,9 @@ internal class Rygel.ContentDirectory: Service {
         this.root_container = plugin.root_container;
         this.http_server = new HTTPServer (this, plugin.name);
 
-        this.updated_containers =  new ArrayList<MediaContainer> ();
+        this.updated_containers = new ArrayList<MediaContainer> ((a, b) => {
+                return a.id == b.id;
+            });
         this.active_imports = new ArrayList<ImportResource> ();
         this.finished_imports = new ArrayList<ImportResource> ();
 


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