Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 3012:d891850c4042 trunk
branch merge
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Mon, 09 Jul 2007 12:08:39 +0200 |
parents | 91a480f68738 |
children | 3b6d316f8b09 |
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 | |
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
|
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 |
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 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
|
204 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
|
205 { |
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 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
|
207 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
|
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 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
|
210 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
|
211 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
|
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 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
|
214 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
|
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 |
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 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
|
218 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
|
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 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 |
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 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
|
227 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
|
228 |
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 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
|
230 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
|
231 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
|
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->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 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
|
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 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
|
237 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
|
238 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
|
239 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
240 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
|
241 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
242 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
|
243 { |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
244 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
|
245 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
|
246 input_plugin_init(PLUGIN(*ip_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
247 } |
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 } |
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
|
249 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
250 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
|
251 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
252 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
|
253 { |
2801 | 254 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
|
255 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
|
256 output_plugin_init(PLUGIN(*op_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
257 } |
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 } |
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
|
259 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
260 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
|
261 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
262 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
|
263 { |
2801 | 264 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
|
265 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
|
266 effect_plugin_init(PLUGIN(*ep_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
267 } |
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 } |
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
|
269 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
270 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
|
271 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
272 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
|
273 { |
2801 | 274 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
|
275 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
|
276 general_plugin_init(PLUGIN(*gp_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
277 } |
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 } |
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
|
279 |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
280 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
|
281 { |
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
282 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
|
283 { |
2801 | 284 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
|
285 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
|
286 vis_plugin_init(PLUGIN(*vp_iter)); |
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
287 } |
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 } |
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 |
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 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
|
292 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
|
293 { |
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 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
|
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 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
|
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 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
|
299 |
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->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
|
301 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
|
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 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
|
304 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
|
305 |
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 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
|
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 /******************************************************************/ |
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 |
2313 | 311 static void |
312 add_plugin(const gchar * filename) | |
313 { | |
314 GModule *module; | |
315 gpointer func; | |
316 | |
317 if (plugin_is_duplicate(filename)) | |
318 return; | |
319 | |
2623 | 320 g_message("Loaded plugin (%s)", filename); |
321 | |
2313 | 322 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
323 printf("Failed to load plugin (%s): %s\n", | |
324 filename, g_module_error()); | |
325 return; | |
326 } | |
327 | |
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
|
328 /* 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
|
329 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
|
330 { |
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_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
|
332 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
|
333 |
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 /* 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
|
335 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
|
336 |
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 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
|
338 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
|
339 } |
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
|
340 |
2313 | 341 printf("Invalid plugin (%s)\n", filename); |
342 g_module_close(module); | |
343 } | |
344 | |
345 static gboolean | |
346 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
347 { | |
348 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
349 return FALSE; | |
350 | |
351 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
352 return FALSE; | |
353 | |
354 add_plugin(path); | |
355 | |
356 return FALSE; | |
357 } | |
358 | |
359 static void | |
360 scan_plugins(const gchar * path) | |
361 { | |
362 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
363 } | |
364 | |
365 void | |
366 plugin_system_init(void) | |
367 { | |
368 gchar *dir, **disabled; | |
369 GList *node; | |
370 OutputPlugin *op; | |
371 InputPlugin *ip; | |
372 LowlevelPlugin *lp; | |
373 gint dirsel = 0, i = 0; | |
374 | |
375 if (!g_module_supported()) { | |
376 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
377 return; | |
378 } | |
379 | |
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
380 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2313 | 381 NULL); |
382 | |
383 #ifndef DISABLE_USER_PLUGIN_DIR | |
384 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
385 /* | |
386 * This is in a separate loop so if the user puts them in the | |
387 * wrong dir we'll still get them in the right order (home dir | |
388 * first) - Zinx | |
389 */ | |
390 while (plugin_dir_list[dirsel]) { | |
391 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
392 plugin_dir_list[dirsel++], NULL); | |
393 scan_plugins(dir); | |
394 g_free(dir); | |
395 } | |
396 dirsel = 0; | |
397 #endif | |
398 | |
399 while (plugin_dir_list[dirsel]) { | |
400 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
401 scan_plugins(dir); | |
402 g_free(dir); | |
403 } | |
404 | |
405 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
406 if (!op_data.current_output_plugin | |
407 && g_list_length(op_data.output_list)) { | |
408 op_data.current_output_plugin = op_data.output_list->data; | |
409 } | |
410 | |
411 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
412 | |
413 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
414 ep_data.enabled_list = NULL; | |
415 | |
416 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
417 gp_data.enabled_list = NULL; | |
418 | |
419 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
420 vp_data.enabled_list = NULL; | |
421 | |
422 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
423 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
424 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
425 | |
426 g_free(cfg.enabled_gplugins); | |
427 cfg.enabled_gplugins = NULL; | |
428 | |
429 g_free(cfg.enabled_vplugins); | |
430 cfg.enabled_vplugins = NULL; | |
431 | |
432 g_free(cfg.enabled_eplugins); | |
433 cfg.enabled_eplugins = NULL; | |
434 | |
435 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
436 op = OUTPUT_PLUGIN(node->data); | |
437 /* | |
438 * Only test basename to avoid problems when changing | |
439 * prefix. We will only see one plugin with the same | |
440 * basename, so this is usually what the user want. | |
441 */ | |
442 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
443 op_data.current_output_plugin = op; | |
444 if (op->init) | |
445 op->init(); | |
446 } | |
447 | |
448 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
449 ip = INPUT_PLUGIN(node->data); | |
450 if (ip->init) | |
451 ip->init(); | |
452 } | |
453 | |
454 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
455 lp = LOWLEVEL_PLUGIN(node->data); | |
456 if (lp->init) | |
457 lp->init(); | |
458 } | |
459 | |
460 if (cfg.disabled_iplugins) { | |
461 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
462 while (disabled[i]) { | |
463 g_hash_table_replace(plugin_matrix, disabled[i], | |
464 GINT_TO_POINTER(FALSE)); | |
465 i++; | |
466 } | |
467 | |
468 g_free(disabled); | |
469 | |
470 g_free(cfg.disabled_iplugins); | |
471 cfg.disabled_iplugins = NULL; | |
472 } | |
473 } | |
474 | |
475 void | |
476 plugin_system_cleanup(void) | |
477 { | |
478 InputPlugin *ip; | |
479 OutputPlugin *op; | |
480 EffectPlugin *ep; | |
481 GeneralPlugin *gp; | |
482 VisPlugin *vp; | |
483 LowlevelPlugin *lp; | |
484 GList *node; | |
485 | |
486 g_message("Shutting down plugin system"); | |
487 | |
488 if (playback_get_playing()) { | |
489 ip_data.stop = TRUE; | |
490 playback_stop(); | |
491 ip_data.stop = FALSE; | |
492 } | |
493 | |
2623 | 494 /* FIXME: race condition -nenolod */ |
495 op_data.current_output_plugin = NULL; | |
496 | |
2313 | 497 for (node = get_input_list(); node; node = g_list_next(node)) { |
498 ip = INPUT_PLUGIN(node->data); | |
499 if (ip && ip->cleanup) { | |
500 ip->cleanup(); | |
501 GDK_THREADS_LEAVE(); | |
502 while (g_main_context_iteration(NULL, FALSE)); | |
503 GDK_THREADS_ENTER(); | |
504 } | |
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
|
505 |
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 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
|
507 g_module_close(ip->handle); |
2313 | 508 } |
509 | |
2623 | 510 if (ip_data.input_list != NULL) |
511 { | |
2313 | 512 g_list_free(ip_data.input_list); |
2623 | 513 ip_data.input_list = NULL; |
514 } | |
2313 | 515 |
516 for (node = get_output_list(); node; node = g_list_next(node)) { | |
517 op = OUTPUT_PLUGIN(node->data); | |
518 if (op && op->cleanup) { | |
519 op->cleanup(); | |
520 GDK_THREADS_LEAVE(); | |
521 while (g_main_context_iteration(NULL, FALSE)); | |
522 GDK_THREADS_ENTER(); | |
523 } | |
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
|
524 |
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 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
|
526 g_module_close(op->handle); |
2313 | 527 } |
528 | |
2623 | 529 if (op_data.output_list != NULL) |
530 { | |
2313 | 531 g_list_free(op_data.output_list); |
2623 | 532 op_data.output_list = NULL; |
533 } | |
2313 | 534 |
535 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
536 ep = EFFECT_PLUGIN(node->data); | |
537 if (ep && ep->cleanup) { | |
538 ep->cleanup(); | |
539 GDK_THREADS_LEAVE(); | |
540 while (g_main_context_iteration(NULL, FALSE)); | |
541 GDK_THREADS_ENTER(); | |
542 } | |
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
|
543 |
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 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
|
545 g_module_close(ep->handle); |
2313 | 546 } |
547 | |
2623 | 548 if (ep_data.effect_list != NULL) |
549 { | |
2313 | 550 g_list_free(ep_data.effect_list); |
2623 | 551 ep_data.effect_list = NULL; |
2313 | 552 } |
553 | |
554 for (node = get_general_list(); node; node = g_list_next(node)) { | |
555 gp = GENERAL_PLUGIN(node->data); | |
556 if (gp && gp->cleanup) { | |
557 gp->cleanup(); | |
558 GDK_THREADS_LEAVE(); | |
559 while (g_main_context_iteration(NULL, FALSE)); | |
560 GDK_THREADS_ENTER(); | |
561 } | |
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
|
562 |
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 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
|
564 g_module_close(gp->handle); |
2313 | 565 } |
566 | |
2623 | 567 if (gp_data.general_list != NULL) |
568 { | |
2313 | 569 g_list_free(gp_data.general_list); |
2623 | 570 gp_data.general_list = NULL; |
2313 | 571 } |
572 | |
573 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
574 vp = VIS_PLUGIN(node->data); | |
575 if (vp && vp->cleanup) { | |
576 vp->cleanup(); | |
577 GDK_THREADS_LEAVE(); | |
578 while (g_main_context_iteration(NULL, FALSE)); | |
579 GDK_THREADS_ENTER(); | |
580 } | |
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
|
581 |
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 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
|
583 g_module_close(vp->handle); |
2313 | 584 } |
585 | |
2623 | 586 if (vp_data.vis_list != NULL) |
587 { | |
2313 | 588 g_list_free(vp_data.vis_list); |
2623 | 589 vp_data.vis_list = NULL; |
590 } | |
2313 | 591 |
592 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
593 lp = LOWLEVEL_PLUGIN(node->data); | |
594 if (lp && lp->cleanup) { | |
595 lp->cleanup(); | |
596 GDK_THREADS_LEAVE(); | |
597 while (g_main_context_iteration(NULL, FALSE)); | |
598 GDK_THREADS_ENTER(); | |
599 } | |
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
|
600 |
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 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
|
602 g_module_close(lp->handle); |
2313 | 603 } |
604 | |
2623 | 605 if (lowlevel_list != NULL) |
606 { | |
2313 | 607 g_list_free(lowlevel_list); |
2623 | 608 lowlevel_list = NULL; |
609 } | |
610 | |
611 /* XXX: vfs will crash otherwise. -nenolod */ | |
612 if (vfs_transports != NULL) | |
613 { | |
614 g_list_free(vfs_transports); | |
615 vfs_transports = NULL; | |
616 } | |
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
617 |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
618 g_hash_table_destroy( plugin_matrix ); |
2313 | 619 } |