assert on duplicate listener in SfxListener

Desktop / LibreOffice - Noel Grandin [] - 16 August 2017 04:41 EDT

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:

bc9a2ba assert on duplicate listener in SfxListener
editeng/source/editeng/impedit5.cxx | 2 +-
include/sal/backtrace.hxx | 44 +++++++++++++++++++++++++
include/svl/lstner.hxx | 4 +--
sal/osl/unx/backtraceapi.cxx | 30 +++++++++++++++++
sal/osl/w32/backtrace.cxx | 51 +++++++++++++++++++++++++++++
sal/util/ | 6 ++++
sd/source/ui/sidebar/MasterPageObserver.cxx | 4 ++-
svl/source/notify/lstner.cxx | 47 +++++++++++++++++++++-----
svx/source/unodraw/unoshape.cxx | 15 ++++++---
sw/source/core/layout/frmtool.cxx | 9 +++--
sw/source/uibase/utlui/navipi.cxx | 3 +-
11 files changed, 194 insertions(+), 21 deletions(-)


  • Share