diff options
author | Marco Pesenti Gritti <marcopg@litl.com> | 2009-03-16 19:26:22 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marcopg@litl.com> | 2010-07-27 22:04:21 (GMT) |
commit | 4e27acdeac6ab99e8cc88d5498829f3d467d98b9 (patch) | |
tree | 9b4ab96908df50c572e316e40af3295ea0ba3a6a /browser-plugin | |
parent | a1f7bc17ee6cc9d7b15cc205a7f3f9f59d357fbc (diff) |
Ensure that libevview is loaded also when calling only NP_GetMIMEDescription.
Diffstat (limited to 'browser-plugin')
-rw-r--r-- | browser-plugin/glue.cpp | 42 |
1 files changed, 27 insertions, 15 deletions
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; |