summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-03-31 19:01:25 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-04-03 07:27:09 +0000
commit637f9ffa6317d7b06e562283f210f67ecafe9e42 (patch)
treef9a14a79b2e427299eee5ea7d280e188ad13bffb
parenttdf#88360: sw: fix crash on closing help in Navigator window (diff)
downloadcore-637f9ffa6317d7b06e562283f210f67ecafe9e42.tar.gz
core-637f9ffa6317d7b06e562283f210f67ecafe9e42.zip
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sfx2/source/appl/appbaslib.cxx14
-rw-r--r--sfx2/source/inc/appbaslib.hxx4
2 files changed, 18 insertions, 0 deletions
diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx
index 980f2db2bdc8..e22091705898 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 5810afdbb789..8e0d5f84bb19 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();