[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - extensions/source

Stephan Bergmann sbergman at redhat.com
Tue Dec 8 08:37:54 PST 2015


 extensions/source/plugin/base/xplugin.cxx           |   11 ++++++++---
 extensions/source/plugin/inc/plugin/win/sysplug.hxx |    3 +++
 extensions/source/plugin/win/sysplug.cxx            |   10 +++++++++-
 3 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 5da95d887ce8f0de9d19a886ebad733be02ae5a5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Dec 8 17:32:13 2015 +0100

    tdf#62381: Stop using NPAPI plugin when NP_Initialize fails
    
    (...in the Windows-specific code path)
    
    Change-Id: I5984ecd88a12d3f22aecaa685bd552f4235fb13d
    (cherry picked from commit 00daa67d745ae84ed15d3f210001193c6e950144)

diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index 43d09ed..46e9034 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 3753212..38c5abf 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();
 
@@ -112,6 +114,7 @@ public:
     virtual NPError     NPP_GetValue( NPP instance, NPPVariable 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 3059641..9c25da3 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();


More information about the Libreoffice-commits mailing list