Kaydet (Commit) 6a23af75 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Ensure listener is removed during ~SdModule

Change-Id: I17fb441eac2593a0b43809f177250d46d6862a58
üst c98f569d
......@@ -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.
......
......@@ -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();
......
......@@ -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;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment