Kaydet (Commit) af67aeff authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid broken static_cast

...from SvtValueItemAcc to unrelated ValueItemAcc in ~SvtValueSetItem.  The
Svt* classes had been copied from the non-Svt* ones in
4883fd31 "weld ScTabBgColorDlg", but this
static_cast had apparently been missed when copying ~SvtValueSetItem from
~ValueSetItem (and the originally copied SvtValueItemAcc::ParentDestroyed had
later been removed with d4d03761
"loplugin:unusedmethods").  But the static_cast in ~ValueSetItem would never
have been necessary in the first place (though that needs partial reversal of
508c95f1 "improve passstuffbyref return
analysis", which had unhelpfully changed ValueSetItem::GetAccessible to return a
reference).

Change-Id: If1c9bb617ac4ad3c24371729504f9082594c048f
Reviewed-on: https://gerrit.libreoffice.org/72914
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 04b60370
......@@ -50,17 +50,17 @@ ValueSetItem::~ValueSetItem()
{
if( mxAcc.is() )
{
static_cast< ValueItemAcc* >( mxAcc.get() )->ParentDestroyed();
mxAcc->ParentDestroyed();
}
}
uno::Reference< accessibility::XAccessible > const & ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
{
if( !mxAcc.is() )
mxAcc = new ValueItemAcc( this, bIsTransientChildrenDisabled );
return mxAcc;
return mxAcc.get();
}
SvtValueSetItem::SvtValueSetItem( SvtValueSet& rParent )
......@@ -77,16 +77,16 @@ SvtValueSetItem::~SvtValueSetItem()
{
if( mxAcc.is() )
{
static_cast< ValueItemAcc* >( mxAcc.get() )->ParentDestroyed();
mxAcc.get()->ParentDestroyed();
}
}
uno::Reference< accessibility::XAccessible > const & SvtValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
uno::Reference< accessibility::XAccessible > SvtValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
{
if( !mxAcc.is() )
mxAcc = new SvtValueItemAcc( this, bIsTransientChildrenDisabled );
return mxAcc;
return mxAcc.get();
}
ValueSetAcc::ValueSetAcc( ValueSet* pParent ) :
......@@ -1073,6 +1073,12 @@ SvtValueItemAcc::~SvtValueItemAcc()
{
}
void SvtValueItemAcc::ParentDestroyed()
{
const ::osl::MutexGuard aGuard( maMutex );
mpParent = nullptr;
}
namespace
{
class theSvtValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvtValueItemAccUnoTunnelId > {};
......
......@@ -47,7 +47,9 @@ enum ValueSetItemType
VALUESETITEM_USERDRAW
};
class ValueItemAcc;
class ValueSet;
class SvtValueItemAcc;
class SvtValueSet;
struct ValueSetItem
......@@ -60,12 +62,12 @@ struct ValueSetItem
Color maColor;
OUString maText;
void* mpData;
css::uno::Reference< css::accessibility::XAccessible > mxAcc;
rtl::Reference< ValueItemAcc > mxAcc;
explicit ValueSetItem( ValueSet& rParent );
~ValueSetItem();
css::uno::Reference< css::accessibility::XAccessible > const &
css::uno::Reference< css::accessibility::XAccessible >
GetAccessible( bool bIsTransientChildrenDisabled );
};
......@@ -79,12 +81,12 @@ struct SvtValueSetItem
Color maColor;
OUString maText;
void* mpData;
css::uno::Reference< css::accessibility::XAccessible > mxAcc;
rtl::Reference< SvtValueItemAcc > mxAcc;
explicit SvtValueSetItem( SvtValueSet& rParent );
~SvtValueSetItem();
css::uno::Reference< css::accessibility::XAccessible > const &
css::uno::Reference< css::accessibility::XAccessible >
GetAccessible( bool bIsTransientChildrenDisabled );
};
......@@ -410,6 +412,8 @@ public:
SvtValueItemAcc(SvtValueSetItem* pParent, bool bIsTransientChildrenDisabled);
virtual ~SvtValueItemAcc() override;
void ParentDestroyed();
void FireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
static SvtValueItemAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) throw();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment