[rygel] core: Copy the factory list before creating devices
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Copy the factory list before creating devices
- Date: Mon, 24 Aug 2009 23:28:16 +0000 (UTC)
commit 7d68b2845128183b89bfe33106fba25e1243dc26
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Jul 30 17:37:32 2009 +0300
core: Copy the factory list before creating devices
We iterate over the copy of the list rather than list itself because
there is high chances of the original list being modified during the
iteration, which is not allowed by libgee.
src/rygel/rygel-main.vala | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 8c95b3c..4f9ba0d 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -73,7 +73,15 @@ public class Rygel.Main : Object {
private void on_plugin_loaded (PluginLoader plugin_loader,
Plugin plugin) {
+ // We iterate over the copy of the list rather than list itself because
+ // there is high chances of the original list being modified during the
+ // iteration, which is not allowed by libgee.
+ var factories = new ArrayList <RootDeviceFactory> ();
foreach (var factory in this.factories) {
+ factories.add (factory);
+ }
+
+ foreach (var factory in factories) {
this.create_device (plugin, factory);
}
}
@@ -109,6 +117,7 @@ public class Rygel.Main : Object {
var factory = new RootDeviceFactory (context);
this.factories.add (factory);
+ // See the comment in on_plugin_loaded method
var plugins = new ArrayList <Plugin> ();
foreach (var plugin in this.plugin_loader.list_plugins ()) {
plugins.add (plugin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]