Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 3121:3b6d316f8b09 trunk
GPL3 relicensing.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 20 Jul 2007 08:59:47 -0500 |
parents | 91a480f68738 |
children | f1c756f39e6c |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
2313 | 21 */ |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 # include "config.h" | |
25 #endif | |
26 | |
27 #ifndef SHARED_SUFFIX | |
28 # define SHARED_SUFFIX G_MODULE_SUFFIX | |
29 #endif | |
30 | |
31 #include "pluginenum.h" | |
32 | |
33 #include <glib.h> | |
34 #include <gmodule.h> | |
35 #include <glib/gprintf.h> | |
36 #include <string.h> | |
37 | |
38 #include "main.h" | |
39 #include "ui_main.h" | |
40 #include "playback.h" | |
41 #include "playlist.h" | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2313
diff
changeset
|
42 #include "strings.h" |
2313 | 43 #include "util.h" |
44 | |
45 #include "effect.h" | |
46 #include "general.h" | |
47 #include "input.h" | |
48 #include "output.h" | |
49 #include "visualization.h" | |
50 | |
51 const gchar *plugin_dir_list[] = { | |
52 PLUGINSUBS, | |
53 NULL | |
54 }; | |
55 | |
56 GHashTable *plugin_matrix = NULL; | |
57 GList *lowlevel_list = NULL; | |
58 | |
2623 | 59 extern GList *vfs_transports; |
60 | |
2313 | 61 static gint |
62 inputlist_compare_func(gconstpointer a, gconstpointer b) | |
63 { | |
64 const InputPlugin *ap = a, *bp = b; | |
2804 | 65 if(ap->description && bp->description) |
66 return strcasecmp(ap->description, bp->description); | |
67 else | |
68 return 0; | |
2313 | 69 } |
70 | |
71 static gint | |
72 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
73 { | |
74 const OutputPlugin *ap = a, *bp = b; | |
2804 | 75 if(ap->description && bp->description) |
76 return strcasecmp(ap->description, bp->description); | |
77 else | |
78 return 0; | |
2313 | 79 } |
80 | |
81 static gint | |
82 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
83 { | |
84 const EffectPlugin *ap = a, *bp = b; | |
2804 | 85 if(ap->description && bp->description) |
86 return strcasecmp(ap->description, bp->description); | |
87 else | |
88 return 0; | |
2313 | 89 } |
90 | |
91 static gint | |
92 generallist_compare_func(gconstpointer a, gconstpointer b) | |
93 { | |
94 const GeneralPlugin *ap = a, *bp = b; | |
2804 | 95 if(ap->description && bp->description) |
96 return strcasecmp(ap->description, bp->description); | |
97 else | |
98 return 0; | |
2313 | 99 } |
100 | |
101 static gint | |
102 vislist_compare_func(gconstpointer a, gconstpointer b) | |
103 { | |
104 const VisPlugin *ap = a, *bp = b; | |
2804 | 105 if(ap->description && bp->description) |
106 return strcasecmp(ap->description, bp->description); | |
107 else | |
108 return 0; | |
2313 | 109 } |
110 | |
111 static gboolean | |
112 plugin_is_duplicate(const gchar * filename) | |
113 { | |
114 GList *l; | |
115 const gchar *basename = g_basename(filename); | |
116 | |
117 /* FIXME: messy stuff */ | |
118 | |
119 for (l = ip_data.input_list; l; l = g_list_next(l)) | |
120 if (!strcmp(basename, g_basename(INPUT_PLUGIN(l->data)->filename))) | |
121 return TRUE; | |
122 | |
123 for (l = op_data.output_list; l; l = g_list_next(l)) | |
124 if (!strcmp(basename, g_basename(OUTPUT_PLUGIN(l->data)->filename))) | |
125 return TRUE; | |
126 | |
127 for (l = ep_data.effect_list; l; l = g_list_next(l)) | |
128 if (!strcmp(basename, g_basename(EFFECT_PLUGIN(l->data)->filename))) | |
129 return TRUE; | |
130 | |
131 for (l = gp_data.general_list; l; l = g_list_next(l)) | |
132 if (!strcmp(basename, g_basename(GENERAL_PLUGIN(l->data)->filename))) | |
133 return TRUE; | |
134 | |
135 for (l = vp_data.vis_list; l; l = g_list_next(l)) | |
136 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
137 return TRUE; | |
138 | |
139 for (l = lowlevel_list; l; l = g_list_next(l)) | |
140 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
141 return TRUE; | |
142 | |
143 return FALSE; | |
144 } | |
145 | |
146 | |
147 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))() | |
148 typedef Plugin * (*PluginGetInfoFunc) (void); | |
149 | |
150 static void | |
151 input_plugin_init(Plugin * plugin) | |
152 { | |
153 InputPlugin *p = INPUT_PLUGIN(plugin); | |
154 | |
155 p->get_vis_type = input_get_vis_type; | |
156 p->add_vis_pcm = input_add_vis_pcm; | |
157 | |
158 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
159 else thinks we could use a CONST macro to solve the warnings? | |
160 - descender */ | |
161 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; | |
162 p->set_info_text = (void (*)(gchar *)) input_set_info_text; | |
163 p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering; | |
164 | |
165 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
166 | |
167 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename), | |
168 GINT_TO_POINTER(1)); | |
169 } | |
170 | |
171 static void | |
172 output_plugin_init(Plugin * plugin) | |
173 { | |
174 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
175 op_data.output_list = g_list_append(op_data.output_list, p); | |
176 } | |
177 | |
178 static void | |
179 effect_plugin_init(Plugin * plugin) | |
180 { | |
181 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
182 ep_data.effect_list = g_list_append(ep_data.effect_list, p); | |
183 } | |
184 | |
185 static void | |
186 general_plugin_init(Plugin * plugin) | |
187 { | |
188 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
189 gp_data.general_list = g_list_append(gp_data.general_list, p); | |
190 } | |
191 | |
192 static void | |
193 vis_plugin_init(Plugin * plugin) | |
194 { | |
195 VisPlugin *p = VIS_PLUGIN(plugin); | |
196 p->disable_plugin = vis_disable_plugin; | |
197 vp_data.vis_list = g_list_append(vp_data.vis_list, p); | |
198 } | |
199 | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
200 /*******************************************************************/ |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
201 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
202 static void |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
203 plugin2_dispose(GModule *module, const gchar *str, ...) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
204 { |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
205 gchar buf[4096]; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
206 va_list va; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
207 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
208 va_start(va, str); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
209 vsnprintf(buf, 4096, str, va); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
210 va_end(va); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
211 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
212 g_print("*** %s\n", buf); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
213 g_module_close(module); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
214 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
215 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
216 void |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
217 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
218 { |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
219 InputPlugin **ip_iter; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
220 OutputPlugin **op_iter; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
221 EffectPlugin **ep_iter; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
222 GeneralPlugin **gp_iter; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
223 VisPlugin **vp_iter; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
224 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
225 if (header->magic != PLUGIN_MAGIC) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
226 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
227 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
228 if (header->api_version != __AUDACIOUS_PLUGIN_API__) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
229 return plugin2_dispose(module, "plugin <%s> discarded, wanting API version %d, we implement API version %d", |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
230 filename, header->api_version, __AUDACIOUS_PLUGIN_API__); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
231 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
232 if (header->init) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
233 header->init(); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
234 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
235 header->priv_assoc = g_new0(Plugin, 1); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
236 header->priv_assoc->handle = module; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
237 header->priv_assoc->filename = g_strdup(filename); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
238 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
239 if (header->ip_list) |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
240 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
241 for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++) |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
242 { |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
243 PLUGIN(*ip_iter)->filename = g_strdup(filename); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
244 g_print("plugin2 '%s' provides InputPlugin <%p>\n", filename, *ip_iter); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
245 input_plugin_init(PLUGIN(*ip_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
246 } |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
247 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
248 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
249 if (header->op_list) |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
250 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
251 for (op_iter = header->op_list; *op_iter != NULL; op_iter++) |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
252 { |
2801 | 253 PLUGIN(*op_iter)->filename = g_strdup(filename); |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
254 g_print("plugin2 '%s' provides OutputPlugin <%p>\n", filename, *op_iter); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
255 output_plugin_init(PLUGIN(*op_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
256 } |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
257 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
258 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
259 if (header->ep_list) |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
260 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
261 for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++) |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
262 { |
2801 | 263 PLUGIN(*ep_iter)->filename = g_strdup(filename); |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
264 g_print("plugin2 '%s' provides EffectPlugin <%p>\n", filename, *ep_iter); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
265 effect_plugin_init(PLUGIN(*ep_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
266 } |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
267 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
268 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
269 if (header->gp_list) |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
270 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
271 for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++) |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
272 { |
2801 | 273 PLUGIN(*gp_iter)->filename = g_strdup(filename); |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
274 g_print("plugin2 '%s' provides GeneralPlugin <%p>\n", filename, *gp_iter); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
275 general_plugin_init(PLUGIN(*gp_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
276 } |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
277 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
278 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
279 if (header->vp_list) |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
280 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
281 for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++) |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
282 { |
2801 | 283 PLUGIN(*vp_iter)->filename = g_strdup(filename); |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
284 g_print("plugin2 '%s' provides VisPlugin <%p>\n", filename, *vp_iter); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
285 vis_plugin_init(PLUGIN(*vp_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
286 } |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
287 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
288 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
289 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
290 void |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
291 plugin2_unload(PluginHeader *header) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
292 { |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
293 GModule *module; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
294 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
295 g_return_if_fail(header->priv_assoc != NULL); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
296 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
297 module = header->priv_assoc->handle; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
298 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
299 g_free(header->priv_assoc->filename); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
300 g_free(header->priv_assoc); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
301 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
302 if (header->fini) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
303 header->fini(); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
304 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
305 g_module_close(module); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
306 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
307 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
308 /******************************************************************/ |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
309 |
2313 | 310 static void |
311 add_plugin(const gchar * filename) | |
312 { | |
313 GModule *module; | |
314 gpointer func; | |
315 | |
316 if (plugin_is_duplicate(filename)) | |
317 return; | |
318 | |
2623 | 319 g_message("Loaded plugin (%s)", filename); |
320 | |
2313 | 321 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
322 printf("Failed to load plugin (%s): %s\n", | |
323 filename, g_module_error()); | |
324 return; | |
325 } | |
326 | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
327 /* v2 plugin loading */ |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
328 if (g_module_symbol(module, "get_plugin_info", &func)) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
329 { |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
330 PluginHeader *(*header_func_p)() = func; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
331 PluginHeader *header; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
332 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
333 /* this should never happen. */ |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
334 g_return_if_fail((header = header_func_p()) != NULL); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
335 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
336 plugin2_process(header, module, filename); |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
337 return; |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
338 } |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
339 |
2313 | 340 printf("Invalid plugin (%s)\n", filename); |
341 g_module_close(module); | |
342 } | |
343 | |
344 static gboolean | |
345 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
346 { | |
347 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
348 return FALSE; | |
349 | |
350 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
351 return FALSE; | |
352 | |
353 add_plugin(path); | |
354 | |
355 return FALSE; | |
356 } | |
357 | |
358 static void | |
359 scan_plugins(const gchar * path) | |
360 { | |
361 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
362 } | |
363 | |
364 void | |
365 plugin_system_init(void) | |
366 { | |
367 gchar *dir, **disabled; | |
368 GList *node; | |
369 OutputPlugin *op; | |
370 InputPlugin *ip; | |
371 LowlevelPlugin *lp; | |
372 gint dirsel = 0, i = 0; | |
373 | |
374 if (!g_module_supported()) { | |
375 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
376 return; | |
377 } | |
378 | |
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
379 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2313 | 380 NULL); |
381 | |
382 #ifndef DISABLE_USER_PLUGIN_DIR | |
383 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
384 /* | |
385 * This is in a separate loop so if the user puts them in the | |
386 * wrong dir we'll still get them in the right order (home dir | |
387 * first) - Zinx | |
388 */ | |
389 while (plugin_dir_list[dirsel]) { | |
390 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
391 plugin_dir_list[dirsel++], NULL); | |
392 scan_plugins(dir); | |
393 g_free(dir); | |
394 } | |
395 dirsel = 0; | |
396 #endif | |
397 | |
398 while (plugin_dir_list[dirsel]) { | |
399 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
400 scan_plugins(dir); | |
401 g_free(dir); | |
402 } | |
403 | |
404 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
405 if (!op_data.current_output_plugin | |
406 && g_list_length(op_data.output_list)) { | |
407 op_data.current_output_plugin = op_data.output_list->data; | |
408 } | |
409 | |
410 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
411 | |
412 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
413 ep_data.enabled_list = NULL; | |
414 | |
415 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
416 gp_data.enabled_list = NULL; | |
417 | |
418 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
419 vp_data.enabled_list = NULL; | |
420 | |
421 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
422 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
423 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
424 | |
425 g_free(cfg.enabled_gplugins); | |
426 cfg.enabled_gplugins = NULL; | |
427 | |
428 g_free(cfg.enabled_vplugins); | |
429 cfg.enabled_vplugins = NULL; | |
430 | |
431 g_free(cfg.enabled_eplugins); | |
432 cfg.enabled_eplugins = NULL; | |
433 | |
434 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
435 op = OUTPUT_PLUGIN(node->data); | |
436 /* | |
437 * Only test basename to avoid problems when changing | |
438 * prefix. We will only see one plugin with the same | |
439 * basename, so this is usually what the user want. | |
440 */ | |
441 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
442 op_data.current_output_plugin = op; | |
443 if (op->init) | |
444 op->init(); | |
445 } | |
446 | |
447 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
448 ip = INPUT_PLUGIN(node->data); | |
449 if (ip->init) | |
450 ip->init(); | |
451 } | |
452 | |
453 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
454 lp = LOWLEVEL_PLUGIN(node->data); | |
455 if (lp->init) | |
456 lp->init(); | |
457 } | |
458 | |
459 if (cfg.disabled_iplugins) { | |
460 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
461 while (disabled[i]) { | |
462 g_hash_table_replace(plugin_matrix, disabled[i], | |
463 GINT_TO_POINTER(FALSE)); | |
464 i++; | |
465 } | |
466 | |
467 g_free(disabled); | |
468 | |
469 g_free(cfg.disabled_iplugins); | |
470 cfg.disabled_iplugins = NULL; | |
471 } | |
472 } | |
473 | |
474 void | |
475 plugin_system_cleanup(void) | |
476 { | |
477 InputPlugin *ip; | |
478 OutputPlugin *op; | |
479 EffectPlugin *ep; | |
480 GeneralPlugin *gp; | |
481 VisPlugin *vp; | |
482 LowlevelPlugin *lp; | |
483 GList *node; | |
484 | |
485 g_message("Shutting down plugin system"); | |
486 | |
487 if (playback_get_playing()) { | |
488 ip_data.stop = TRUE; | |
489 playback_stop(); | |
490 ip_data.stop = FALSE; | |
491 } | |
492 | |
2623 | 493 /* FIXME: race condition -nenolod */ |
494 op_data.current_output_plugin = NULL; | |
495 | |
2313 | 496 for (node = get_input_list(); node; node = g_list_next(node)) { |
497 ip = INPUT_PLUGIN(node->data); | |
498 if (ip && ip->cleanup) { | |
499 ip->cleanup(); | |
500 GDK_THREADS_LEAVE(); | |
501 while (g_main_context_iteration(NULL, FALSE)); | |
502 GDK_THREADS_ENTER(); | |
503 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
504 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
505 if (ip->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
506 g_module_close(ip->handle); |
2313 | 507 } |
508 | |
2623 | 509 if (ip_data.input_list != NULL) |
510 { | |
2313 | 511 g_list_free(ip_data.input_list); |
2623 | 512 ip_data.input_list = NULL; |
513 } | |
2313 | 514 |
515 for (node = get_output_list(); node; node = g_list_next(node)) { | |
516 op = OUTPUT_PLUGIN(node->data); | |
517 if (op && op->cleanup) { | |
518 op->cleanup(); | |
519 GDK_THREADS_LEAVE(); | |
520 while (g_main_context_iteration(NULL, FALSE)); | |
521 GDK_THREADS_ENTER(); | |
522 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
523 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
524 if (op->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
525 g_module_close(op->handle); |
2313 | 526 } |
527 | |
2623 | 528 if (op_data.output_list != NULL) |
529 { | |
2313 | 530 g_list_free(op_data.output_list); |
2623 | 531 op_data.output_list = NULL; |
532 } | |
2313 | 533 |
534 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
535 ep = EFFECT_PLUGIN(node->data); | |
536 if (ep && ep->cleanup) { | |
537 ep->cleanup(); | |
538 GDK_THREADS_LEAVE(); | |
539 while (g_main_context_iteration(NULL, FALSE)); | |
540 GDK_THREADS_ENTER(); | |
541 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
542 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
543 if (ep->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
544 g_module_close(ep->handle); |
2313 | 545 } |
546 | |
2623 | 547 if (ep_data.effect_list != NULL) |
548 { | |
2313 | 549 g_list_free(ep_data.effect_list); |
2623 | 550 ep_data.effect_list = NULL; |
2313 | 551 } |
552 | |
553 for (node = get_general_list(); node; node = g_list_next(node)) { | |
554 gp = GENERAL_PLUGIN(node->data); | |
555 if (gp && gp->cleanup) { | |
556 gp->cleanup(); | |
557 GDK_THREADS_LEAVE(); | |
558 while (g_main_context_iteration(NULL, FALSE)); | |
559 GDK_THREADS_ENTER(); | |
560 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
561 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
562 if (gp->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
563 g_module_close(gp->handle); |
2313 | 564 } |
565 | |
2623 | 566 if (gp_data.general_list != NULL) |
567 { | |
2313 | 568 g_list_free(gp_data.general_list); |
2623 | 569 gp_data.general_list = NULL; |
2313 | 570 } |
571 | |
572 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
573 vp = VIS_PLUGIN(node->data); | |
574 if (vp && vp->cleanup) { | |
575 vp->cleanup(); | |
576 GDK_THREADS_LEAVE(); | |
577 while (g_main_context_iteration(NULL, FALSE)); | |
578 GDK_THREADS_ENTER(); | |
579 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
580 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
581 if (vp->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
582 g_module_close(vp->handle); |
2313 | 583 } |
584 | |
2623 | 585 if (vp_data.vis_list != NULL) |
586 { | |
2313 | 587 g_list_free(vp_data.vis_list); |
2623 | 588 vp_data.vis_list = NULL; |
589 } | |
2313 | 590 |
591 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
592 lp = LOWLEVEL_PLUGIN(node->data); | |
593 if (lp && lp->cleanup) { | |
594 lp->cleanup(); | |
595 GDK_THREADS_LEAVE(); | |
596 while (g_main_context_iteration(NULL, FALSE)); | |
597 GDK_THREADS_ENTER(); | |
598 } | |
2797
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
599 |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
600 if (lp->handle) |
f0c1c8b22c88
[svn] - 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
nenolod
parents:
2795
diff
changeset
|
601 g_module_close(lp->handle); |
2313 | 602 } |
603 | |
2623 | 604 if (lowlevel_list != NULL) |
605 { | |
2313 | 606 g_list_free(lowlevel_list); |
2623 | 607 lowlevel_list = NULL; |
608 } | |
609 | |
610 /* XXX: vfs will crash otherwise. -nenolod */ | |
611 if (vfs_transports != NULL) | |
612 { | |
613 g_list_free(vfs_transports); | |
614 vfs_transports = NULL; | |
615 } | |
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
616 |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
617 g_hash_table_destroy( plugin_matrix ); |
2313 | 618 } |