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