summaryrefslogtreecommitdiff
path: root/include/sal/backtrace.hxx
AgeCommit message (Collapse)Author
2017-10-23loplugin:includeform: UNO API include filesStephan Bergmann
Change these back to consistently use the "..." form to include other UNO API include files, for the benefit of external users of this API. Change-Id: I9c9188e895eb3495e20a71ad44abfa2f6061fa94
2017-09-06Clean up sal/backtrace.hxxStephan Bergmann
Change-Id: Id78e9c0ca29ff2e52591f3d446431ac23c20ab7a Reviewed-on: https://gerrit.libreoffice.org/41926 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-03Fix leak BacktraceState (enable-dbgutil)Julien Nabet
buffer is created from sal/osl/unx/backtraceapi.cxx with: 70 auto b1 = new void *[maxDepth]; 71 int n = backtrace(b1, static_cast<int>(maxDepth)); 72 return std::unique_ptr<BacktraceState>(new BacktraceState{ b1, n }); and from sal/osl/w32/backtrace.cxx with: 79 auto pStack = new void *[maxDepth]; 80 // https://msdn.microsoft.com/en-us/library/windows/desktop/bb204633.aspx 81 // "CaptureStackBackTrace function" claims that you "can capture up to 82 // MAXUSHORT frames", and on Windows Server 2003 and Windows XP it even 83 // "must be less than 63", but assume that a too large input value is 84 // clamped internally, instead of resulting in an error: 85 int nFrames = CaptureStackBackTrace( 0, static_cast<ULONG>(maxDepth), pStack, nullptr ); 86 87 return std::unique_ptr<BacktraceState>(new BacktraceState{ pStack, nFrames }); Introduced with: https://cgit.freedesktop.org/libreoffice/core/commit/?id=bc9a2ba677ce3fcd46c2bbef6e8faeacb14292c1 Change-Id: Iea0528f5d2b38ff1f3dc4bd50ff035bb100ab981 Reviewed-on: https://gerrit.libreoffice.org/41854 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-16assert on duplicate listener in SfxListenerNoel Grandin
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>