summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-29 09:48:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-29 11:02:45 +0100
commita65b6a4626d85880a4f39bda177473df91cf5369 (patch)
treee6915d68d0447b3dbf99a48552d313880c82e976 /sfx2
parent947feaa896168430c78dd08dabee1447133f2740 (diff)
valgrind: memleak when sidebar open in writer on close
==3768== 512 bytes in 1 blocks are possibly lost in loss record 25,532 of 28,010 ==3768== at 0x4A06965: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3768== by 0xB52FA41: __gnu_cxx::new_allocator<bool>::allocate(unsigned long, void const*) (new_allocator.h:104) ==3768== by 0xB52EC00: std::__cxx1998::_Deque_base<bool, std::allocator<bool> >::_M_allocate_node() (stl_deque.h:533) ==3768== by 0xB52DE4E: std::__cxx1998::_Deque_base<bool, std::allocator<bool> >::_M_create_nodes(bool**, bool**) (stl_deque.h:627) ==3768== by 0xB52C624: std::__cxx1998::_Deque_base<bool, std::allocator<bool> >::_M_initialize_map(unsigned long) (stl_deque.h:601) ==3768== by 0xB52ACA0: std::__cxx1998::_Deque_base<bool, std::allocator<bool> >::_Deque_base(std::allocator<bool> const&, unsigned long) (stl_deque.h:461) ==3768== by 0xB5296D3: std::__cxx1998::deque<bool, std::allocator<bool> >::deque(std::allocator<bool> const&) (stl_deque.h:791) ==3768== by 0xB52840E: std::__debug::deque<bool, std::allocator<bool> >::deque(std::allocator<bool> const&) (deque:73) ==3768== by 0xB52786B: framework::UndoManagerHelper_Impl::UndoManagerHelper_Impl(framework::IUndoManagerImplementation&) (undomanagerhelper.cxx:221) ==3768== by 0xB525882: framework::UndoManagerHelper::UndoManagerHelper(framework::IUndoManagerImplementation&) (undomanagerhelper.cxx:879) ==3768== by 0x6872683: sfx2::DocumentUndoManager_Impl::DocumentUndoManager_Impl(sfx2::DocumentUndoManager&) (docundomanager.cxx:88) ==3768== by 0x6870FB6: sfx2::DocumentUndoManager::DocumentUndoManager(SfxBaseModel&) (docundomanager.cxx:227) ==3768== by 0x687A272: SfxBaseModel::getUndoManager() (sfxbasemodel.cxx:1677) ==3768== by 0x260E562A: (anonymous namespace)::getUndoManager(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) (PagePropertyPanel.cxx:74) ==3768== by 0x260E6C60: sw::sidebar::PagePropertyPanel::PagePropertyPanel(Window*, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, SfxBindings*) (PagePropertyPanel.cxx:189) ==3768== by 0x260E593C: sw::sidebar::PagePropertyPanel::Create(Window*, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, SfxBindings*) (PagePropertyPanel.cxx:101) The SfxBaseModel creates the DocumentUndoManager on demand at sfx2/source/doc/sfxbasemodel.cxx:1685 m_pDocumentUndoManager is a rtl::Reference but debugging into the acquire/release I see that the DocumentUndoManager::acquire/DocumentUndoManager::release forward to those of SfxModelSubComponent which forward them to its rModel without doing anything else, so the implementations of DocumentUndoManager::acquire/DocumentUndoManager::release don't actually do anything directly to the DocumentUndoManager itself so there is nothing that will really release it. Either the rModel needs to explicitly destroy it somehow, given that the acquire/release delegate responsibility to it, or the whole thing is addled. I rather feel it's addled, so implement as a normal WeakImplHelper1, but cowardly in addition also keep acquire/release on the rModel. Change-Id: Ib52544a9276fd8d9d489ad6b6afda12498cc39fa
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docundomanager.cxx14
-rw-r--r--sfx2/source/inc/docundomanager.hxx3
2 files changed, 8 insertions, 9 deletions
diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx
index 5ab013c157c4..ff876138dd45 100644
--- a/sfx2/source/doc/docundomanager.cxx
+++ b/sfx2/source/doc/docundomanager.cxx
@@ -19,12 +19,12 @@
#include "docundomanager.hxx"
+#include <cppuhelper/weak.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/bindings.hxx>
-
#include <com/sun/star/lang/XComponent.hpp>
#include <comphelper/anytostring.hxx>
@@ -228,12 +228,10 @@ namespace sfx2
{
}
-
DocumentUndoManager::~DocumentUndoManager()
{
}
-
void DocumentUndoManager::disposing()
{
m_pImpl->disposing();
@@ -247,15 +245,17 @@ namespace sfx2
}
- void SAL_CALL DocumentUndoManager::acquire( ) throw ()
+ void SAL_CALL DocumentUndoManager::acquire() throw()
{
- SfxModelSubComponent::acquire();
+ OWeakObject::acquire();
+ SfxModelSubComponent::acquireModel();
}
- void SAL_CALL DocumentUndoManager::release( ) throw ()
+ void SAL_CALL DocumentUndoManager::release() throw()
{
- SfxModelSubComponent::release();
+ SfxModelSubComponent::releaseModel();
+ OWeakObject::release();
}
diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx
index 31d8731cc36c..044d0fb7ca9d 100644
--- a/sfx2/source/inc/docundomanager.hxx
+++ b/sfx2/source/inc/docundomanager.hxx
@@ -37,8 +37,7 @@ namespace sfx2
//= DocumentUndoManager
- typedef ::cppu::ImplHelper1 < ::com::sun::star::document::XUndoManager
- > DocumentUndoManager_Base;
+ typedef ::cppu::WeakImplHelper1 <css::document::XUndoManager> DocumentUndoManager_Base;
struct DocumentUndoManager_Impl;
class DocumentUndoManager :public DocumentUndoManager_Base
,public SfxModelSubComponent