[rygel] core: Can't remove from ArrayList during iteration
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] core: Can't remove from ArrayList during iteration
- Date: Wed, 8 Jul 2009 17:01:19 +0000 (UTC)
commit 2f7143f7485fae32d9de5c06ebb9224dc36dca25
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jul 8 17:54:22 2009 +0300
core: Can't remove from ArrayList during iteration
src/rygel/rygel-main.vala | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 3033a66..8b5d285 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -129,17 +129,27 @@ public class Rygel.Main : Object {
context.name,
context.host_ip);
+ var factory_list = new ArrayList <RootDeviceFactory> ();
foreach (var factory in this.factories) {
if (context == factory.context) {
- this.factories.remove (factory);
+ factory_list.add (factory);
}
}
+ foreach (var factory in factory_list) {
+ this.factories.remove (factory);
+ }
+
+ var device_list = new ArrayList <RootDevice> ();
foreach (var device in this.root_devices) {
if (context == device.context) {
- this.root_devices.remove (device);
+ device_list.add (device);
}
}
+
+ foreach (var device in device_list) {
+ this.root_devices.remove (device);
+ }
}
private void create_device (Plugin plugin,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]