diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-02-24 14:22:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-02-24 14:23:28 +0100 |
commit | 6a23af75c01afabadd82dded59602d52f5a0ef21 (patch) | |
tree | 1339e353be2aaebcfbc48a1da01c6734fc94d184 | |
parent | c98f569d035861b6b8c74b469512fa2ae7c9576f (diff) |
Ensure listener is removed during ~SdModule
Change-Id: I17fb441eac2593a0b43809f177250d46d6862a58
-rw-r--r-- | sd/inc/sdmod.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod.cxx | 13 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod1.cxx | 6 |
3 files changed, 8 insertions, 13 deletions
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index c4fca2c14cfa..250fa8e9695c 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 3821bcc56d33..6ab2cc2f605c 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 cba122f4c784..dad7b14889c4 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; } } } |