[Libreoffice-commits] core.git: svtools/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 24 21:10:14 UTC 2019
svtools/source/control/valueacc.cxx | 18 ++++++++++++------
svtools/source/control/valueimp.hxx | 12 ++++++++----
2 files changed, 20 insertions(+), 10 deletions(-)
New commits:
commit af67aeff0e76c1130401685824a6a2d9216e8abe
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri May 24 17:40:55 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri May 24 23:08:53 2019 +0200
Avoid broken static_cast
...from SvtValueItemAcc to unrelated ValueItemAcc in ~SvtValueSetItem. The
Svt* classes had been copied from the non-Svt* ones in
4883fd31141c3598b25a123033297f847cd18552 "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 d4d037619638e1915d15dba81c38a1c9b3157972
"loplugin:unusedmethods"). But the static_cast in ~ValueSetItem would never
have been necessary in the first place (though that needs partial reversal of
508c95f1b655d9cfa6be37a5a9de9aff6fd383bf "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: Stephan Bergmann <sbergman at redhat.com>
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index b6a74cc43d6a..1033fa1c52fd 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -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 > {};
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index c960434a6159..635a7d0da624 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -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();
More information about the Libreoffice-commits
mailing list