summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-08 17:32:13 +0100
committerMichael Stahl <mstahl@redhat.com>2015-12-08 22:07:10 +0000
commit448fec81bf45e0e74be887d139519a3c403c625e (patch)
tree478ca466528de8bbd06d84fe1c4d6af6482546ba
parent819f33e67cfdfea8358bce3f80230bced72696a6 (diff)
tdf#62381: Stop using NPAPI plugin when NP_Initialize fails
(...in the Windows-specific code path) Change-Id: I5984ecd88a12d3f22aecaa685bd552f4235fb13d (cherry picked from commit 00daa67d745ae84ed15d3f210001193c6e950144) Reviewed-on: https://gerrit.libreoffice.org/20474 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--extensions/source/plugin/base/xplugin.cxx11
-rw-r--r--extensions/source/plugin/inc/plugin/win/sysplug.hxx3
-rw-r--r--extensions/source/plugin/win/sysplug.cxx10
3 files changed, 20 insertions, 4 deletions
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index 9933739cddca..c1a25dc4e63a 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -548,9 +548,14 @@ void XPlugin_Impl::loadPlugin()
return;
#elif defined WNT
- PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype,
- m_aDescription.PluginName,
- (HWND)pEnvData->hWnd );
+ PluginComm* pComm;
+ try {
+ pComm = new PluginComm_Impl(
+ m_aDescription.Mimetype, m_aDescription.PluginName,
+ (HWND)pEnvData->hWnd);
+ } catch (PluginComm_Impl::CannotInitializeException &) {
+ return;
+ }
#endif
setPluginComm( pComm );
diff --git a/extensions/source/plugin/inc/plugin/win/sysplug.hxx b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
index 555d4004e3e2..bd4ff2c326f8 100644
--- a/extensions/source/plugin/inc/plugin/win/sysplug.hxx
+++ b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
@@ -86,6 +86,8 @@ class PluginComm_Impl :
virtual long doIt();
public:
+ struct CannotInitializeException {};
+
PluginComm_Impl( const OUString& rMIME, const OUString& rName, HWND hWnd );
virtual ~PluginComm_Impl();
@@ -114,6 +116,7 @@ public:
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue );
private:
+ void shutdown();
BOOL retrieveFunction( TCHAR const * pName, void** ppFunc ) const;
private:
diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx
index d34c80012295..eb14ec05be88 100644
--- a/extensions/source/plugin/win/sysplug.cxx
+++ b/extensions/source/plugin/win/sysplug.cxx
@@ -98,12 +98,20 @@ PluginComm_Impl::PluginComm_Impl( const OUString& /*rMIME*/, const OUString& rNa
"### version failure!" );
m_eCall = eNP_Initialize;
- execute();
+ if (execute() != NPERR_NO_ERROR) {
+ shutdown();
+ throw CannotInitializeException();
+ }
}
PluginComm_Impl::~PluginComm_Impl()
{
+ shutdown();
+}
+
+void PluginComm_Impl::shutdown()
+{
if (_plDLL)
{
// NPP_Shutdown();