cid#1607338 Data race condition
move this logic to the destructor, like we do elsewhere Change-Id: Ie41c78b0a01d79020cb77fd5be70116f473e910f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174747 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
950c4537a6
commit
ae44d2affa
2 changed files with 4 additions and 25 deletions
|
@ -87,9 +87,6 @@ public:
|
|||
// SfxStyleSheetBase
|
||||
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) override;
|
||||
|
||||
// XInterface
|
||||
virtual void SAL_CALL release( ) noexcept override;
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
||||
|
|
|
@ -149,6 +149,10 @@ SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool&
|
|||
|
||||
SdStyleSheet::~SdStyleSheet()
|
||||
{
|
||||
// restore reference count, prevent double-delete from calling dispose
|
||||
osl_atomic_increment( &m_refCount );
|
||||
dispose();
|
||||
|
||||
delete pSet;
|
||||
pSet = nullptr; // that following destructors also get a change
|
||||
}
|
||||
|
@ -727,28 +731,6 @@ rtl::Reference<SdStyleSheet> SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBa
|
|||
return new SdStyleSheet(aName, rPool, eFamily, SfxStyleSearchBits::UserDefined);
|
||||
}
|
||||
|
||||
// XInterface
|
||||
|
||||
void SAL_CALL SdStyleSheet::release( ) noexcept
|
||||
{
|
||||
if (osl_atomic_decrement( &m_refCount ) != 0)
|
||||
return;
|
||||
|
||||
// restore reference count:
|
||||
osl_atomic_increment( &m_refCount );
|
||||
if (! m_bDisposed) try
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
catch (RuntimeException const&)
|
||||
{
|
||||
// don't break throw ()
|
||||
TOOLS_WARN_EXCEPTION( "sd", "" );
|
||||
}
|
||||
OSL_ASSERT( m_bDisposed );
|
||||
SdStyleSheetBase::release();
|
||||
}
|
||||
|
||||
// XComponent
|
||||
|
||||
void SAL_CALL SdStyleSheet::dispose( )
|
||||
|
|
Loading…
Reference in a new issue