[banshee] [Mtp] Iterate over a copy of the Children list (bgo#629519)



commit b93d986f36a5a7af2d8226bd63bf01cc349416c4
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Thu Sep 23 22:10:50 2010 +0200

    [Mtp] Iterate over a copy of the Children list (bgo#629519)
    
    This should avoid "System.InvalidOperationException: Collection was
    modified" exceptions.

 .../Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs   |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
index a2263b0..fb01faa 100644
--- a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
+++ b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
@@ -242,7 +242,8 @@ namespace Banshee.Dap.Mtp
                 device_playlists.Clear ();
 
                 // Add playlists from Banshee to the device
-                foreach (Source child in Children) {
+                List<Source> children = new List<Source> (Children);
+                foreach (Source child in children) {
                     PlaylistSource from = child as PlaylistSource;
                     if (from != null && from.Count > 0) {
                         MTP.Playlist playlist = new MTP.Playlist (mtp_device, from.Name);



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