[banshee] [GioHardware] Prevent unmounting crash if no udev device is found



commit dfee70720a7a458840f0b7def1960940c418d94f
Author: Alan McGovern <alan mcgovern gmail com>
Date:   Wed Sep 1 21:31:36 2010 +0100

    [GioHardware] Prevent unmounting crash if no udev device is found
    
    If the dictionary mapping gio volumes to udev devices does not have a
    mapping for a particular gio volume, log and bail out. Otherwise we'll
    just crash later on trying to get metadata from the non-existant udev
    device.

 .../Banshee.Hardware.Gio/LowLevel/Manager.cs       |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/Manager.cs b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/Manager.cs
index 61a977d..1275856 100644
--- a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/Manager.cs
+++ b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/Manager.cs
@@ -115,7 +115,10 @@ namespace Banshee.Hardware.Gio
             var h = DeviceRemoved;
             if (h != null) {
                 GUdev.Device device;
-                volume_device_map.TryGetValue (volume.Handle, out device);
+                if (!volume_device_map.TryGetValue (volume.Handle, out device)) {
+                    Hyena.Log.Debug (string.Format ("Tried to unmount {0}/{1} with no matching udev device", volume.Name, volume.Uuid));
+                    return;
+                }
                 var v = new RawVolume (volume,
                                           this,
                                           new GioVolumeMetadataSource (volume),



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