[Libreoffice-commits] core.git: sd/inc sd/source
Stephan Bergmann
sbergman at redhat.com
Tue Feb 24 05:24:22 PST 2015
sd/inc/sdmod.hxx | 2 ++
sd/source/ui/app/sdmod.cxx | 13 ++++---------
sd/source/ui/app/sdmod1.cxx | 6 ++----
3 files changed, 8 insertions(+), 13 deletions(-)
New commits:
commit 6a23af75c01afabadd82dded59602d52f5a0ef21
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 24 14:22:56 2015 +0100
Ensure listener is removed during ~SdModule
Change-Id: I17fb441eac2593a0b43809f177250d46d6862a58
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index c4fca2c..250fa8e 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -159,6 +159,8 @@ private:
*/
::std::unique_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
+ bool mbEventListenerAdded;
+
/** Create a new summary page. When the document has been created in
the kiosk mode with automatical transitions then this method adds
this kind of transition to the new summary page.
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 3821bcc..6ab2cc2 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -78,7 +78,8 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
pSearchItem(NULL),
pNumberFormatter( NULL ),
bWaterCan(false),
- mpResourceContainer(new ::sd::SdGlobalResourceContainer())
+ mpResourceContainer(new ::sd::SdGlobalResourceContainer()),
+ mbEventListenerAdded(false)
{
SetName( OUString( "StarDraw" ) ); // Do not translate!
pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
@@ -105,15 +106,9 @@ SdModule::~SdModule()
delete pSearchItem;
delete pNumberFormatter;
- ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
- if( pDocShell )
+ if (mbEventListenerAdded)
{
- ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
- if (pViewShell)
- {
- // Removing our event listener
- Application::RemoveEventListener( LINK( this, SdModule, EventListenerHdl ) );
- }
+ Application::RemoveEventListener( LINK( this, SdModule, EventListenerHdl ) );
}
mpResourceContainer.reset();
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index cba122f..dad7b14 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -315,8 +315,6 @@ bool SdModule::OutlineToImpress(SfxRequest& rRequest)
return rRequest.IsDone();
}
-static bool bOnce = false;
-
void SdModule::GetState(SfxItemSet& rItemSet)
{
// disable Autopilot during presentation
@@ -403,7 +401,7 @@ void SdModule::GetState(SfxItemSet& rItemSet)
rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) );
}
- if ( !bOnce )
+ if ( !mbEventListenerAdded )
{
::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
if( pDocShell ) // Impress or Draw ?
@@ -414,7 +412,7 @@ void SdModule::GetState(SfxItemSet& rItemSet)
{
// add our event listener as soon as possible
Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) );
- bOnce = true;
+ mbEventListenerAdded = true;
}
}
}
More information about the Libreoffice-commits
mailing list