From: Zeeshan Ali (Khattak) Date: Thu, 30 Jul 2009 14:37:32 +0000 (+0300) Subject: core: Copy the factory list before creating devices X-Git-Tag: RYGEL_0_4~183 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d68b2845128183b89bfe33106fba25e1243dc26;p=profile%2Fivi%2Frygel.git 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. --- 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 (); 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 (); foreach (var plugin in this.plugin_loader.list_plugins ()) { plugins.add (plugin);