From 4e27acdeac6ab99e8cc88d5498829f3d467d98b9 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 16 Mar 2009 19:26:22 +0000 Subject: Ensure that libevview is loaded also when calling only NP_GetMIMEDescription. --- diff --git a/browser-plugin/glue.cpp b/browser-plugin/glue.cpp index 027f55f..74a3a34 100644 --- a/browser-plugin/glue.cpp +++ b/browser-plugin/glue.cpp @@ -36,11 +36,35 @@ NPNetscapeFuncs NPNFuncs; static char *mimeDescription = NULL; +static bool +InitEvince (void) +{ + if (ev_is_initialized ()) { + return true; + } + +#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 false; + } + g_module_make_resident (module); + g_module_close (module); +#endif + + ev_init (); + + return true; +} + char * NP_GetMIMEDescription (void) { - if (!ev_is_initialized()) { - ev_init (); + if (!InitEvince ()) { + return NULL; } if (mimeDescription == NULL) { @@ -67,21 +91,9 @@ NP_GetMIMEDescription (void) NPError NP_Initialize (NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs) { -#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) { + if (!InitEvince ()) { return NPERR_MODULE_LOAD_FAILED_ERROR; } - g_module_make_resident (module); - g_module_close (module); -#endif - - if (!ev_is_initialized()) { - ev_init (); - } if (aNPNFuncs == NULL || aNPPFuncs == NULL) { return NPERR_INVALID_FUNCTABLE_ERROR; -- cgit v0.9.1