[rygel] media-export: Fix crash on item removal



commit 35aedc3ed33cad7300d93f97112a0048f5d52c51
Author: Jens Georg <jensg openismus com>
Date:   Mon Aug 5 16:53:06 2013 +0200

    media-export: Fix crash on item removal
    
    MediaCache.get_object can return null if the object wasn't found in the
    cache. On certain conditions this can happen while uploading (removal
    queue vs. manual remove from client). Take this into account and just
    warn instead of crash.
    
    This isn't the proper fix for the issue but at least it stopps Rygel from
    crashing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702633

 .../rygel-media-export-writable-db-container.vala  |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-writable-db-container.vala 
b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
index 6676032..afc7ba3 100644
--- a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
@@ -102,8 +102,11 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
     public virtual async void remove_item (string id, Cancellable? cancellable)
                                            throws Error {
         var object = this.media_db.get_object (id);
-
-        yield this.remove_child_tracked (object);
+        if (object != null) {
+            yield this.remove_child_tracked (object);
+        } else {
+            warning (_("Could not find object %d in cache"), id);
+        }
     }
 
     public virtual async void remove_container (string id,


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