rygel r318 - trunk/src/rygel



Author: zeeshanak
Date: Fri Nov 28 12:59:41 2008
New Revision: 318
URL: http://svn.gnome.org/viewvc/rygel?rev=318&view=rev

Log:
Make the module resident rather than keeping a ref to it.

Rygel was crashing on exit because of modules being unloaded while there
were still objects of classes provided by the module. I thought I had
solved the issue by keeping a ref to each module in the PluginLoader but
the problem with that approach is that it is not guaranteed the
PluginLoader will not be freed before all the objects of classes it
provides.

Modified:
   trunk/src/rygel/rygel-plugin-loader.vala

Modified: trunk/src/rygel/rygel-plugin-loader.vala
==============================================================================
--- trunk/src/rygel/rygel-plugin-loader.vala	(original)
+++ trunk/src/rygel/rygel-plugin-loader.vala	Fri Nov 28 12:59:41 2008
@@ -32,19 +32,11 @@
  * calls it and expects a Plugin instance in return.
  */
 public class Rygel.PluginLoader : Object {
-    /* We need to keep the modules somewhere */
-    private List<Module> modules;
-
     private delegate Plugin LoadPluginFunc ();
 
     // Signals
     public signal void plugin_available (Plugin plugin);
 
-    /* Pubic methods */
-    public PluginLoader () {
-        this.modules = new List<Module> ();
-    }
-
     // Plugin loading functions
     public void load_plugins () {
         assert (Module.supported());
@@ -117,8 +109,10 @@
 
         Plugin plugin = load_plugin ();
         if (plugin != null) {
+            // We don't want our modules to ever unload
+            module.make_resident ();
+
             this.plugin_available (plugin);
-            this.modules.append (#module);
         }
     }
 



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