From 7e79db67e1a61229b7aa4c0bd180f27be1f2727b Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 16 Mar 2009 13:33:05 +0000 Subject: Use g_module to keep libevview in memory. Add code which uses NPPVpluginKeepLibraryInMemory to achieve the same, currently defined out because broken in mozilla. --- 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 (plugin); +#ifdef USE_PLUGIN_KEEP_IN_MEMORY + NPNFuncs.setvalue (instance, NPPVpluginKeepLibraryInMemory, (void *)PR_TRUE); +#endif + return NPERR_NO_ERROR; } -- cgit v0.9.1