[rygel] core: Prevent a crash in ImportResource



commit fe2dbdc4eed0e7ec0e1a52ad2c3b1bc5c54e17ea
Author: Jens Georg <mail jensge org>
Date:   Fri May 27 09:52:10 2011 +0200

    core: Prevent a crash in ImportResource
    
    If a plugin has several items sharing the same URI in multiple
    containers, deleting the item from one container can lead to the
    fact that the item is still present in a non-writable container.

 src/rygel/rygel-import-resource.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-import-resource.vala b/src/rygel/rygel-import-resource.vala
index 165044e..8490409 100644
--- a/src/rygel/rygel-import-resource.vala
+++ b/src/rygel/rygel-import-resource.vala
@@ -177,7 +177,9 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
                                                                   null);
         string msg = null;
 
-        if (media_object == null || !(media_object is MediaItem)) {
+        if (media_object == null ||
+            !(media_object is MediaItem) ||
+            !(media_object.parent is WritableContainer)) {
             msg = _("URI '%s' invalid for importing contents to").printf
                                         (this.destination_uri);
         } else if (!(media_object as MediaItem).place_holder) {



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