sw/source/core/unocore/unodraw.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 789c27c52f90997f38e49cb1377eb2caaad3a95e
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Apr 15 10:31:50 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Apr 15 11:41:36 2025 +0200

    attempt to fix JunitTest_toolkit_unoapi_4  crash
    
    seen on jenkins, where it looks like things are destructing that need to be 
destructed while the solar mutex is held.
    
    Thread 1 (Thread 0x7f41c94fc700 (LWP 2563514)):
      ^#0  0x00007f41e7b771cb in SfxItemPool::IsInRange(unsigned short) const 
(this=0x9999999999999999, nWhich=1077) at include/svl/itempool.hxx:332
      ^#1  0x00007f41e7b6cd84 in SfxItemPool::getTargetPool(unsigned short) 
const (this=0x9999999999999999, nWhich=1077) at 
svl/source/items/itempool.cxx:452
      ^#2  0x00007f41e7b6cdd7 in SfxItemPool::getTargetPool(unsigned short) 
const (this=0x53e0740, nWhich=1077) at svl/source/items/itempool.cxx:455
      ^#3  0x00007f41e7b6ce27 in SfxItemPool::CheckItemInfoFlag(unsigned short, 
unsigned short) const (this=0x53e0740, nWhich=1077, nMask=1) at 
svl/source/items/itempool.cxx:461
            pTarget = 0x7f41c94f7eb0
      ^#4  0x00007f41e7bd18a5 in SfxItemPool::NeedsSurrogateSupport(unsigned 
short) const (this=0x53e0740, nWhich=1077) at include/svl/itempool.hxx:344
      ^#5  0x00007f41e7bc407a in 
SfxItemSet::checkRemovePoolRegistration(SfxPoolItem const*) (this=0x6253bf0, 
pItem=0x6253dd0) at svl/source/items/itemset.cxx:382
      ^#6  0x00007f41e7bc3fc7 in 
SfxItemSet::ClearSingleItem_PrepareRemove(SfxPoolItem const*) (this=0x6253bf0, 
pItem=0x6253dd0) at svl/source/items/itemset.cxx:362
      ^#7  0x00007f41e7bc3bc0 in SfxItemSet::ClearAllItemsImpl() 
(this=0x6253bf0) at svl/source/items/itemset.cxx:441
            rCandidate = {first = 1077, second = 0x6253dd0}
            __range1 = std::__debug::unordered_map with 3 elements = {[1077] = 
0x6253dd0, [4037] = 0x60b2e30, [1082] = 0x6253d70}
            __begin1 = {<std::__detail::_Node_iterator_base<std::pair<unsigned 
short const, SfxPoolItem const*>, false>> = {_M_cur = 0x6253e00}, <No data 
fields>}
            __end1 = {<std::__detail::_Node_iterator_base<std::pair<unsigned 
short const, SfxPoolItem const*>, false>> = {_M_cur = 0x0}, <No data fields>}
            nRetval = 0
      ^#8  0x00007f41e7bc389b in SfxItemSet::~SfxItemSet() (this=0x6253bf0) at 
svl/source/items/itemset.cxx:316
      ^#9  0x00007f41e5ff6ccc in 
std::_Optional_payload_base<SfxItemSet>::_M_destroy() (this=0x6253bf0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/optional:287
      ^#10 0x00007f41e5ff6caa in 
std::_Optional_payload_base<SfxItemSet>::_M_reset() (this=0x6253bf0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/optional:318
      ^#11 0x00007f41e5ff6db9 in std::_Optional_payload<SfxItemSet, false, 
false, false>::~_Optional_payload() (this=0x6253bf0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/optional:439
      ^#12 0x00007f41e5ff6d95 in std::_Optional_base<SfxItemSet, false, 
false>::~_Optional_base() (this=0x6253bf0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/optional:510
      ^#13 0x00007f41e5ff4025 in std::optional<SfxItemSet>::~optional() 
(this=0x6253bf0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/optional:705
      ^#14 0x00007f41e62467eb in 
sdr::properties::DefaultProperties::~DefaultProperties() (this=0x6253be0) at 
svx/source/sdr/properties/defaultproperties.cxx:92
      ^#15 0x00007f41e625061d in 
sdr::properties::AttributeProperties::~AttributeProperties() (this=0x6253be0) 
at svx/source/sdr/properties/attributeproperties.cxx:219
      ^#16 0x00007f41e624a225 in 
sdr::properties::TextProperties::~TextProperties() (this=0x6253be0) at 
svx/source/sdr/properties/textproperties.cxx:78
      ^#17 0x00007f41e6241525 in 
sdr::properties::RectangleProperties::~RectangleProperties() (this=0x6253be0) 
at svx/source/sdr/properties/rectangleproperties.cxx:38
      ^#18 0x00007f41e6241569 in 
sdr::properties::RectangleProperties::~RectangleProperties() (this=0x6253be0) 
at svx/source/sdr/properties/rectangleproperties.cxx:37
      ^#19 0x00007f41e6429a1c in 
std::default_delete<sdr::properties::BaseProperties>::operator()(sdr::properties::BaseProperties*)
 const (this=0x6217e58, __ptr=0x6253be0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:95
      ^#20 0x00007f41e642995c in 
std::__uniq_ptr_impl<sdr::properties::BaseProperties, 
std::default_delete<sdr::properties::BaseProperties> 
>::reset(sdr::properties::BaseProperties*) (this=0x6217e58, __p=0x0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:203
            __old_p = 0x6253be0
      ^#21 0x00007f41e642612a in 
std::unique_ptr<sdr::properties::BaseProperties, 
std::default_delete<sdr::properties::BaseProperties> 
>::reset(sdr::properties::BaseProperties*) (this=0x6217e58, __p=0x0) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:501
      ^#22 0x00007f41e6414094 in SdrObject::~SdrObject() (this=0x6217d00) at 
svx/source/svdraw/svdobj.cxx:461
            aList = std::__debug::vector of length 0, capacity 1
      ^#23 0x00007f41e64121d5 in SdrAttrObj::~SdrAttrObj() (this=0x6217d00) at 
svx/source/svdraw/svdoattr.cxx:42
      ^#24 0x00007f41e64bb91b in SdrTextObj::~SdrTextObj() (this=0x6217d00) at 
svx/source/svdraw/svdotext.cxx:203
      ^#25 0x00007f41e64b6c2f in SdrRectObj::~SdrRectObj() (this=0x6217d00) at 
svx/source/svdraw/svdorect.cxx:99
      ^#26 0x00007f41e6511024 in SdrUnoObj::~SdrUnoObj() (this=0x6217d00) at 
svx/source/svdraw/svdouno    m_xShapeAgg.clear();
    .cxx:223
      ^#27 0x00007f41e5f56988 in FmFormObj::~FmFormObj() (this=0x6217d00) at 
svx/source/form/fmobj.cxx:119
      ^#28 0x00007f41e5f569d9 in FmFormObj::~FmFormObj() (this=0x6217d00) at 
svx/source/form/fmobj.cxx:112
      ^#29 0x00007f41e64145c6 in SdrObject::release() (this=0x6217d00) at 
svx/source/svdraw/svdobj.cxx:484
            x = 0
      ^#30 0x00007f41e62baf29 in rtl::Reference<SdrObject>::clear() 
(this=0x60e3e78) at include/rtl/ref.hxx:193
            pOld = 0x6217d00
      ^#31 0x00007f41e683ba73 in SvxShape::~SvxShape() (this=0x60e3ca8) at 
svx/source/unodraw/unoshape.cxx:197
            aGuard = {<osl::Guard<comphelper::SolarMutex>> = {pT = 0x1502140}, 
<No data fields>}
      ^#32 0x00007f41e685637a in SvxShapeText::~SvxShapeText() (this=0x60e3ca8) 
at svx/source/unodraw/unoshape.cxx:3852
      ^#33 0x00007f41e681ac5d in SvxShapeControl::~SvxShapeControl() 
(this=0x60e3ca0) at svx/source/unodraw/unoshap2.cxx:479
      ^#34 0x00007f41e681ace9 in SvxShapeControl::~SvxShapeControl() 
(this=0x60e3ca0) at svx/source/unodraw/unoshap2.cxx:478
      ^#35 0x00007f41ea9f7110 in cppu::OWeakObject::release() (this=0x60e3ca8) 
at cppuhelper/source/weak.cxx:230
      ^#36 0x00007f41ea9f7835 in cppu::OWeakAggObject::release() 
(this=0x60e3ca8) at cppuhelper/source/weak.cxx:292
            x = empty uno::Reference
      ^#37 0x00007f41e6731dd5 in 
cppu::WeakAggImplHelper12<com::sun::star::drawing::XShape, 
com::sun::star::lang::XComponent, com::sun::star::beans::XPropertySet, 
com::sun::star::beans::XMultiPropertySet, 
com::sun::star::beans::XPropertyState, com::sun::star::lang::XUnoTunnel, 
com::sun::star::container::XNamed, 
com::sun::star::drawing::XGluePointsSupplier, 
com::sun::star::container::XChild, com::sun::star::lang::XServiceInfo, 
com::sun::star::document::XActionLockable, 
com::sun::star::beans::XMultiPropertyStates>::release() (this=0x60e3ca8) at 
include/cppuhelper/implbase12.hxx:166
      ^#38 0x00007f41e6827885 in SvxShapeText::release() (this=0x60e3ca8) at 
include/svx/unoshape.hxx:358
      ^#39 0x00007f41e68270c9 in SvxShapeControl::release() (this=0x60e3ca0) at 
include/svx/unoshape.hxx:533
      ^#40 0x00007f41cbdb121e in 
com::sun::star::uno::Reference<com::sun::star::uno::XAggregation>::~Reference() 
(this=0x60b39a0) at include/com/sun/star/uno/Reference.hxx:114
      ^#41 0x00007f41cbd9f601 in SwXShape::~SwXShape() (this=0x60b3940) at 
sw/source/core/unocore/unodraw.cxx:974
            aGuard = {<osl::Guard<comphelper::SolarMutex>> = {pT = 0x1502140}, 
<No data fields>}
      ^#42 0x00007f41cbd9f699 in SwXShape::~SwXShape() (this=0x60b3940) at 
sw/source/core/unocore/unodraw.cxx:963
      ^#43 0x00007f41ea9f7110 in cppu::OWeakObject::release() (this=0x60b3940) 
at cppuhelper/source/weak.cxx:230
      ^#44 0x00007f41cbdb3485 in 
cppu::WeakImplHelper<com::sun::star::beans::XPropertySet, 
com::sun::star::beans::XPropertyState, com::sun::star::text::XTextContent, 
com::sun::star::lang::XServiceInfo, com::sun::star::lang::XUnoTunnel, 
com::sun::star::drawing::XShape>::release() (this=0x60b3940) at 
include/cppuhelper/implbase.hxx:115
      ^#45 0x00007f41d2748b6d in 
bridges::cpp_uno::shared::freeUnoInterfaceProxy(uno_ExtEnvironment*, void*) 
(pEnv=0x26d0dc0, pProxy=0x610fed0) at 
bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42
    
    Change-Id: Id129278ad720095d2ed77271ac2d47ba82ec32c7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184199
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index ee24aaf4173b..48505ac7eedd 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -971,6 +971,9 @@ SwXShape::~SwXShape()
     m_pImpl.reset();
     if(m_pPage)
        const_cast<SwFmDrawPage*>(m_pPage)->RemoveShape(this);
+    // these have to be destructed under the solarmutex
+    m_xShapeAgg.clear();
+    mxShape.clear();
 }
 
 uno::Any SwXShape::queryInterface( const uno::Type& aType )

Reply via email to