summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-14 11:02:43 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-14 11:02:43 +0200
commit43d79bfdb6541098a83efd6678469d96fa102b85 (patch)
tree294038cfd63e7c2a71fb67d8d8a23a73f34041ba /scripting
parent4416d2c74a0243bcf38e8d470bd8ca00f52bb3de (diff)
dba34a: #i113403# reset m_documentBasicManager to NULL when it dies
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basscript.cxx22
-rw-r--r--scripting/source/basprov/basscript.hxx6
-rw-r--r--scripting/source/basprov/makefile.mk1
3 files changed, 28 insertions, 1 deletions
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx
index 620e249362..06f58b94bf 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -80,11 +80,33 @@ namespace basprov
,m_documentBasicManager( &documentBasicManager )
,m_xDocumentScriptContext( documentScriptContext )
{
+ StartListening( *m_documentBasicManager );
}
// -----------------------------------------------------------------------------
BasicScriptImpl::~BasicScriptImpl()
{
+ if ( m_documentBasicManager )
+ EndListening( *m_documentBasicManager );
+ }
+
+ // -----------------------------------------------------------------------------
+ // SfxListener
+ // -----------------------------------------------------------------------------
+ void BasicScriptImpl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+ {
+ if ( &rBC != m_documentBasicManager )
+ {
+ OSL_ENSURE( false, "BasicScriptImpl::Notify: where does this come from?" );
+ // not interested in
+ return;
+ }
+ const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if ( pSimpleHint && ( pSimpleHint->GetId() == SFX_HINT_DYING ) )
+ {
+ m_documentBasicManager = NULL;
+ EndListening( rBC ); // prevent multiple notifications
+ }
}
// -----------------------------------------------------------------------------
diff --git a/scripting/source/basprov/basscript.hxx b/scripting/source/basprov/basscript.hxx
index a524c186b2..99d351ee51 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <cppuhelper/implbase1.hxx>
#include <basic/sbmeth.hxx>
+#include <svl/lstner.hxx>
class BasicManager;
@@ -49,7 +50,7 @@ namespace basprov
::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
- class BasicScriptImpl : public BasicScriptImpl_BASE
+ class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener
{
private:
SbMethodRef m_xMethod;
@@ -80,6 +81,9 @@ namespace basprov
::com::sun::star::script::provider::ScriptFrameworkErrorException,
::com::sun::star::reflection::InvocationTargetException,
::com::sun::star::uno::RuntimeException );
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
};
//.........................................................................
diff --git a/scripting/source/basprov/makefile.mk b/scripting/source/basprov/makefile.mk
index 5001e5db28..0340419e2a 100644
--- a/scripting/source/basprov/makefile.mk
+++ b/scripting/source/basprov/makefile.mk
@@ -58,6 +58,7 @@ SHL1STDLIBS= \
$(SFX2LIB) \
$(BASICLIB) \
$(VCLLIB) \
+ $(SVLLIB) \
$(TOOLSLIB) \
$(UCBHELPERLIB) \
$(COMPHELPERLIB) \