Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--browser-plugin/glue.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/browser-plugin/glue.cpp b/browser-plugin/glue.cpp
index 6028f70..48562b4 100644
--- a/browser-plugin/glue.cpp
+++ b/browser-plugin/glue.cpp
@@ -59,14 +59,17 @@ NP_GetMIMEDescription (void)
NPError
NP_Initialize (NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs)
{
- /* We need to force libevview to stay in memory because unloading
- breaks gobject type registration and possibly other things. */
- void *handle;
- handle = dlopen ("libevview.so.1.0.0", RTLD_NOW | RTLD_NODELETE);
- if (!handle) {
+#ifndef USE_PLUGIN_KEEP_IN_MEMORY
+ /* Keep libevview in memory. NPPVpluginKeepLibraryInMemory is broken.
+ See https://bugzilla.mozilla.org/show_bug.cgi?id=359870 */
+
+ GModule *module = g_module_open ("libevview", (GModuleFlags)0);
+ if (module == NULL) {
return NPERR_MODULE_LOAD_FAILED_ERROR;
}
- dlclose (handle);
+ g_module_make_resident (module);
+ g_module_close (module);
+#endif
ev_init ();
@@ -179,6 +182,10 @@ NPP_New (NPMIMEType mimetype,
Plugin *plugin = new Plugin (instance);
instance->pdata = reinterpret_cast<void*> (plugin);
+#ifdef USE_PLUGIN_KEEP_IN_MEMORY
+ NPNFuncs.setvalue (instance, NPPVpluginKeepLibraryInMemory, (void *)PR_TRUE);
+#endif
+
return NPERR_NO_ERROR;
}