changeset 2799:febdfe7a482b trunk

[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
author nenolod
date Thu, 24 May 2007 03:41:13 -0700
parents 7144a4e5e978
children f42a5b531c03
files ChangeLog src/audacious/build_stamp.c src/audacious/pluginenum.c
diffstat 3 files changed, 40 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 24 03:37:54 2007 -0700
+++ b/ChangeLog	Thu May 24 03:41:13 2007 -0700
@@ -1,3 +1,11 @@
+2007-05-24 10:37:54 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [4622]
+  - temporarily work around plugin API v1 retardation
+  
+  trunk/src/audacious/pluginenum.c |    1 +
+  1 file changed, 1 insertion(+)
+
+
 2007-05-24 10:27:54 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4620]
   - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
--- a/src/audacious/build_stamp.c	Thu May 24 03:37:54 2007 -0700
+++ b/src/audacious/build_stamp.c	Thu May 24 03:41:13 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070524-4620";
+const gchar *svn_stamp = "20070524-4622";
--- a/src/audacious/pluginenum.c	Thu May 24 03:37:54 2007 -0700
+++ b/src/audacious/pluginenum.c	Thu May 24 03:41:13 2007 -0700
@@ -229,35 +229,50 @@
     header->priv_assoc->handle = module;
     header->priv_assoc->filename = g_strdup(filename);
 
-    for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++)
+    if (header->ip_list)
     {
-        PLUGIN(*ip_iter)->filename = g_strdup(filename);
-        g_print("plugin2 '%s' provides InputPlugin <%p>", filename, *ip_iter);
-        input_plugin_init(PLUGIN(*ip_iter));
+        for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++)
+        {
+            PLUGIN(*ip_iter)->filename = g_strdup(filename);
+            g_print("plugin2 '%s' provides InputPlugin <%p>\n", filename, *ip_iter);
+            input_plugin_init(PLUGIN(*ip_iter));
+        }
     }
 
-    for (op_iter = header->op_list; *op_iter != NULL; op_iter++)
+    if (header->op_list)
     {
-        g_print("plugin2 '%s' provides OutputPlugin <%p>", filename, *op_iter);
-        output_plugin_init(PLUGIN(*op_iter));
+        for (op_iter = header->op_list; *op_iter != NULL; op_iter++)
+        {
+            g_print("plugin2 '%s' provides OutputPlugin <%p>\n", filename, *op_iter);
+            output_plugin_init(PLUGIN(*op_iter));
+        }
     }
 
-    for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++)
+    if (header->ep_list)
     {
-        g_print("plugin2 '%s' provides EffectPlugin <%p>", filename, *ep_iter);
-        effect_plugin_init(PLUGIN(*ep_iter));
+        for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++)
+        {
+            g_print("plugin2 '%s' provides EffectPlugin <%p>\n", filename, *ep_iter);
+            effect_plugin_init(PLUGIN(*ep_iter));
+        }
     }
 
-    for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++)
+    if (header->gp_list)
     {
-        g_print("plugin2 '%s' provides GeneralPlugin <%p>", filename, *gp_iter);
-        general_plugin_init(PLUGIN(*gp_iter));
+        for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++)
+        {
+            g_print("plugin2 '%s' provides GeneralPlugin <%p>\n", filename, *gp_iter);
+            general_plugin_init(PLUGIN(*gp_iter));
+        }
     }
 
-    for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++)
+    if (header->vp_list)
     {
-        g_print("plugin2 '%s' provides VisPlugin <%p>", filename, *vp_iter);
-        vis_plugin_init(PLUGIN(*vp_iter));
+        for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++)
+        {
+            g_print("plugin2 '%s' provides VisPlugin <%p>\n", filename, *vp_iter);
+            vis_plugin_init(PLUGIN(*vp_iter));
+        }
     }
 }