summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-08-10 10:39:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-16 10:41:56 +0200
commitbc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1 (patch)
tree49a79f270e5ac924c18602c7ee6631cd07ab918a /sw
parent747a38a77df7b9d1365670d32d604c2fa69e869f (diff)
assert on duplicate listener in SfxListener
To enable finding the source of the duplicate calls, I add new SAL API (only for internal use) to retrieve and symbolise stack backtraces. The theory is that it relatively cheap to just store a backtrace, but quite expense to symbolise it to strings. Note that the backtrace() library we use on Linux does not do a particularly good job, but it gives enough information that developers can use the addr2line tool to get more precise info. Explanation of fixes in the code that triggered the assert: In SwFrameHolder, we need to only call StartListening() if the pFrame member is actually changing. We also need to call EndListening() on the old values when pFrame changes. In SwNavigationPI, there is already a StartListening() call in the only place we assign to m_pCreateView. In ImpEditEngine, we need to ignore duplicates, because it is doing a ref-counting thing. By storing duplicates on the listener list, it doesn't need to keep track of which stylesheets its child nodes are using. Given that it therefore will see duplicate events, there is probably some performance optimisation opportunities here. In MasterPageObserver::Implementation::RegisterDocument, we seem to be getting called multiple times with the same SdDrawDocument, so just check if we've been registered already before calling StartListening() In SvxShape::impl_initFromSdrObject, do the same thing we do elsewhere in this class, i.e. only call StartListening() if the model has changed. Change-Id: I7eae5c774e1e8d56f0ad7bec80e4df0017b287ac Reviewed-on: https://gerrit.libreoffice.org/41045 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/frmtool.cxx9
-rw-r--r--sw/source/uibase/utlui/navipi.cxx3
2 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index f058859f0401..5beb864aa1f6 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3181,8 +3181,13 @@ public:
void SwFrameHolder::SetFrame( SwFrame* pHold )
{
bSet = true;
- pFrame = pHold;
- StartListening(*pHold);
+ if (pFrame != pHold)
+ {
+ if (pFrame)
+ EndListening(*pFrame);
+ StartListening(*pHold);
+ pFrame = pHold;
+ }
}
void SwFrameHolder::Reset()
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index e580cefb034f..9765031357ed 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -718,8 +718,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
m_aGlobalTree->SetFont(aFont);
StartListening(*SfxGetpApp());
- if ( m_pCreateView )
- StartListening(*m_pCreateView);
sal_uInt16 nNavId = m_aContentToolBox->GetItemId("navigation");
m_aContentToolBox->SetItemBits(nNavId, m_aContentToolBox->GetItemBits(nNavId) | ToolBoxItemBits::DROPDOWNONLY );
@@ -886,6 +884,7 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
{
if (rHint.GetId() == SfxHintId::Dying)
{
+ EndListening(*m_pCreateView);
m_pCreateView = nullptr;
}
}