diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-30 10:49:01 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-06-01 15:37:03 +0200 |
commit | 824fb52a0a6ad02c985cb639a2a959a8ecca6eaf (patch) | |
tree | c70c42e0bd458003397c7499f699a3bb5807bf05 /svx | |
parent | 720d271788432883e0c968e9dd51bd80ed4b7050 (diff) |
Related: tdf#107961 ensure notifyhdl is unset after dispose
Change-Id: I69790c8d3cfffc09ee6d6c165e17823223c5058a
Reviewed-on: https://gerrit.libreoffice.org/38238
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit cbd8fd58c6d5ad40561b936b1c7f3b75f518b6c2)
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unodraw/unoshtxt.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index b7bd9a66fcba..e3b59926f5c8 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -101,6 +101,7 @@ private: bool mbForwarderIsEditMode; // have to reflect that, since ENDEDIT can happen more often bool mbShapeIsEditMode; // #104157# only true, if SdrHintKind::BeginEdit was received bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder) + bool mbNotifyEditOutlinerSet; SvxUnoTextRangeBaseList maTextRanges; @@ -173,7 +174,8 @@ SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText mbOldUndoMode ( false ), mbForwarderIsEditMode ( false ), mbShapeIsEditMode ( false ), - mbNotificationsDisabled ( false ) + mbNotificationsDisabled ( false ), + mbNotifyEditOutlinerSet ( false ) { DBG_ASSERT( mpObject, "invalid pObject!" ); @@ -209,7 +211,8 @@ SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText mbOldUndoMode ( false ), mbForwarderIsEditMode ( false ), mbShapeIsEditMode ( true ), - mbNotificationsDisabled ( false ) + mbNotificationsDisabled ( false ), + mbNotifyEditOutlinerSet ( false ) { if( !mpText ) { @@ -391,7 +394,10 @@ void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) // register as listener - need to broadcast state change messages if( mpView && mpView->GetTextEditOutliner() ) + { mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) ); + mbNotifyEditOutlinerSet = true; + } // #104157# Only now we're really in edit mode mbShapeIsEditMode = true; @@ -410,7 +416,10 @@ void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) // remove as listener - outliner might outlive ourselves if( mpView && mpView->GetTextEditOutliner() ) + { mpView->GetTextEditOutliner()->SetNotifyHdl( Link<EENotify&,void>() ); + mbNotifyEditOutlinerSet = false; + } // destroy view forwarder, OutlinerView no longer // valid (no need for UpdateData(), it's been @@ -484,6 +493,12 @@ void SvxTextEditSourceImpl::dispose() if( mpView ) { + // remove as listener - outliner might outlive ourselves + if (mbNotifyEditOutlinerSet && mpView && mpView->GetTextEditOutliner()) + { + mpView->GetTextEditOutliner()->SetNotifyHdl(Link<EENotify&,void>()); + mbNotifyEditOutlinerSet = false; + } EndListening( *mpView ); mpView = nullptr; } @@ -731,6 +746,7 @@ SvxDrawOutlinerViewForwarder* SvxTextEditSourceImpl::CreateViewForwarder() { // register as listener - need to broadcast state change messages mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) ); + mbNotifyEditOutlinerSet = true; SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( mpObject ); if( pTextObj ) |