[Libreoffice-commits] core.git: sw/source

Jan Holesovsky kendy at collabora.com
Tue Feb 18 09:47:27 CET 2014


 sw/source/ui/docvw/PostItMgr.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 2b2c528826b6b29d90fcb6a8e755c75cb0d65985
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Feb 18 09:37:57 2014 +0100

    Protect PostIt deletion by SolarMutex.
    
    I was getting crashes during editing with notes; unfortunately I am unable to
    reproduce it reliably, so I am not 100% sure this is the right fix - but I
    hope so.
    
    This is what valgrind was suggesting:
    
    ==21766== Invalid read of size 8
    ==21766==    at 0x285AF9C7: std::__debug::list<SwSidebarItem*, std::allocator<SwSidebarItem*> >::remove(SwSidebarItem* const&) (list:569)
    ==21766==    by 0x285A2BFC: SwPostItMgr::RemoveItem(SfxBroadcaster*) (PostItMgr.cxx:241)
    ==21766==    by 0x285A3241: SwPostItMgr::Notify(SfxBroadcaster&, SfxHint const&) (PostItMgr.cxx:346)
    ==21766==    by 0x84AFB1E: SfxBroadcaster::Broadcast(SfxHint const&) (brdcst.cxx:46)
    ...
    ==21766==    by 0xA5A3C74: Application::Yield() (svapp.cxx:393)
    ==21766==    by 0xA5A3C20: Application::Execute() (svapp.cxx:342)
    ==21766==    by 0x50EA0F4: desktop::Desktop::Main() (app.cxx:1678)
    ...
    ==21766==  Address 0x2e2824f0 is 16 bytes inside a block of size 24 free'd
    ==21766==    at 0x4C2AA9C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==21766==    by 0x285B4B85: __gnu_cxx::new_allocator<std::__cxx1998::_List_node<SwSidebarItem*> >::deallocate(std::__cxx1998::_List_node<SwSidebarItem*>*, unsigned long) (new_allocator.h:100)
    ==21766==    by 0x285B40C1: std::__cxx1998::_List_base<SwSidebarItem*, std::allocator<SwSidebarItem*> >::_M_put_node(std::__cxx1998::_List_node<SwSidebarItem*>*) (stl_list.h:339)
    ==21766==    by 0x285B43BB: std::__cxx1998::list<SwSidebarItem*, std::allocator<SwSidebarItem*> >::_M_erase(std::__cxx1998::_List_iterator<SwSidebarItem*>) (stl_list.h:1549)
    ==21766==    by 0x285B346E: std::__cxx1998::list<SwSidebarItem*, std::allocator<SwSidebarItem*> >::erase(std::__cxx1998::_List_iterator<SwSidebarItem*>) (list.tcc:113)
    ==21766==    by 0x285B18EB: std::__debug::list<SwSidebarItem*, std::allocator<SwSidebarItem*> >::_M_erase(std::__cxx1998::_List_iterator<SwSidebarItem*>) (list:423)
    ==21766==    by 0x285AF9E6: std::__debug::list<SwSidebarItem*, std::allocator<SwSidebarItem*> >::remove(SwSidebarItem* const&) (list:570)
    ==21766==    by 0x285A2BFC: SwPostItMgr::RemoveItem(SfxBroadcaster*) (PostItMgr.cxx:241)
    ==21766==    by 0x285A3241: SwPostItMgr::Notify(SfxBroadcaster&, SfxHint const&) (PostItMgr.cxx:346)
    ==21766==    by 0x84AFB1E: SfxBroadcaster::Broadcast(SfxHint const&) (brdcst.cxx:46)
    ...
    ==21766==    by 0xA5A3C74: Application::Yield() (svapp.cxx:393)
    ==21766==    by 0xA5A3C20: Application::Execute() (svapp.cxx:342)
    ==21766==
    
    Change-Id: I0ed3e09338810200766bd10203d9fcac26e822f6

diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 99a8ebe..86d2dd2 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -230,6 +230,8 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
 
 void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
 {
+    SolarMutexGuard aGuard;
+
     EndListening(*pBroadcast);
     for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
     {


More information about the Libreoffice-commits mailing list