diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-10 10:39:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-16 10:41:56 +0200 |
commit | bc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1 (patch) | |
tree | 49a79f270e5ac924c18602c7ee6631cd07ab918a /include/sal | |
parent | Further clarifications (diff) | |
download | core-bc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1.tar.gz core-bc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1.zip |
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 'include/sal')
-rw-r--r-- | include/sal/backtrace.hxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/sal/backtrace.hxx b/include/sal/backtrace.hxx new file mode 100644 index 000000000000..2c854e102eef --- /dev/null +++ b/include/sal/backtrace.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SAL_BACKTRACE_HXX +#define INCLUDED_SAL_BACKTRACE_HXX + +#include <sal/config.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <memory> + +/// @cond INTERNAL +/** + Two stage API for recording and then later decoding stack backtraces. + Useful for debugging facilities where we are only interested in decoding + a small handful of recorded stack traces. + + @param backtraceDepth value indicating the maximum backtrace depth; must be > 0 +*/ +#if defined LIBO_INTERNAL_ONLY + +struct BacktraceState { + void** buffer; + int nDepth; +}; + +SAL_DLLPUBLIC std::unique_ptr<BacktraceState> SAL_CALL sal_backtrace_get( + sal_uInt32 backtraceDepth); + +SAL_DLLPUBLIC OUString SAL_CALL sal_backtrace_to_string( + BacktraceState* backtraceState); + +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |