[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sfx2/source

Michael Stahl mstahl at redhat.com
Fri Apr 3 00:27:42 PDT 2015


 sfx2/source/appl/appbaslib.cxx |   14 ++++++++++++++
 sfx2/source/inc/appbaslib.hxx  |    4 ++++
 2 files changed, 18 insertions(+)

New commits:
commit 637f9ffa6317d7b06e562283f210f67ecafe9e42
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Mar 31 19:01:25 2015 +0200

    sfx2: fix VBA crash when disposing SfxBaseModel
    
    Crash on WNT in CppunitTest_sw_globalfilter testSkipImages()
    
    SfxBaseModel::dispose() calls some event listener that deletes the
    BasicManager instance; unfortunately SfxObjectShell_Impl has a
    SfxBasicHolder member that still refers to the deleted BasicManager
    and then something calls vba::getVBAServiceFactory()...
    
    Try to fix that by clearing the SfxBasicHolder member via SfxListener.
    
    Change-Id: I65f2ec8e9eb598be218136c06ed8de35a464a971
    (cherry picked from commit fae6699c2ec8d68766bb8d5f71483d4b65792327)
    Reviewed-on: https://gerrit.libreoffice.org/15103
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx
index 980f2db..e220917 100644
--- a/sfx2/source/appl/appbaslib.cxx
+++ b/sfx2/source/appl/appbaslib.cxx
@@ -43,6 +43,19 @@ SfxBasicManagerHolder::SfxBasicManagerHolder()
 {
 }
 
+void SfxBasicManagerHolder::Notify(SfxBroadcaster& rBC, SfxHint const& rHint)
+{
+    if (!mpBasicManager || &rBC != mpBasicManager)
+        return;
+    SfxSimpleHint const*const pSimpleHint(dynamic_cast<SfxSimpleHint const*>(&rHint));
+    if (pSimpleHint && SFX_HINT_DYING == pSimpleHint->GetId())
+    {
+        mpBasicManager = nullptr;
+        mxBasicContainer.clear();
+        mxDialogContainer.clear();
+    }
+}
+
 void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager )
 {
     impl_releaseContainers();
@@ -59,6 +72,7 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager )
 
     if ( mpBasicManager )
     {
+        StartListening(*mpBasicManager);
         try
         {
             mxBasicContainer.set( mpBasicManager->GetScriptLibraryContainer(), UNO_QUERY_THROW );
diff --git a/sfx2/source/inc/appbaslib.hxx b/sfx2/source/inc/appbaslib.hxx
index 5810afd..8e0d5f8 100644
--- a/sfx2/source/inc/appbaslib.hxx
+++ b/sfx2/source/inc/appbaslib.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_SFX2_SOURCE_INC_APPBASLIB_HXX
 #define INCLUDED_SFX2_SOURCE_INC_APPBASLIB_HXX
 
+#include <svl/lstner.hxx>
+
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
@@ -29,6 +31,7 @@ class BasicManager;
 /** helper class which holds and manipulates a BasicManager
 */
 class SfxBasicManagerHolder
+    : public SfxListener
 {
 private:
     BasicManager*   mpBasicManager;
@@ -84,6 +87,7 @@ public:
     */
     bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< OUString >& sModules );
 
+    virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) SAL_OVERRIDE;
 
 private:
     void    impl_releaseContainers();


More information about the Libreoffice-commits mailing list