[banshee/stable-1.8] [Gio] Fix the implementation of GetAllBlockDevices<T>



commit e0162e2d8a21f381223f32e8b2314749fc44c5a8
Author: Alan McGovern <alan mcgovern gmail com>
Date:   Fri Nov 5 01:44:37 2010 +0000

    [Gio] Fix the implementation of GetAllBlockDevices<T>
    
    When trying to figure out what block devices need to be returned
    we should be checking that the devices are of type 'T', not
    IBlockDevice. Fixes the invalid cast exception in #631961.

 .../Banshee.Hardware.Gio/HardwareManager.cs        |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/HardwareManager.cs b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/HardwareManager.cs
index 6640252..fe3366c 100644
--- a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/HardwareManager.cs
+++ b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/HardwareManager.cs
@@ -98,12 +98,12 @@ namespace Banshee.Hardware.Gio
         }
 #endregion
 
-        private IEnumerable<T> GetAllBlockDevices<T> () where T : IBlockDevice
+        private IEnumerable<T> GetAllBlockDevices<T> () where T : class, IBlockDevice
         {
             foreach (var lowDevice in manager.GetAllDevices ()) {
-                IBlockDevice device = lowDevice as IBlockDevice;
+                T device = lowDevice as T;
                 if (device != null) {
-                    yield return (T) device;
+                    yield return device;
                 }
             }
         }



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