diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-08-13 16:58:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-08-13 17:08:22 +0200 |
commit | 07ebec47da4a096aaab53bf6a90bb219ce29bfbf (patch) | |
tree | 55b125e7256c576e19415e319b84ea342aeb7c6b /vcl/unx/gtk/a11y/atktextattributes.cxx | |
parent | dd8fbd4c8ae18421975f45c7aa7befbf74f0b0d7 (diff) |
rhbz#1247588: Hold UNO objects by css::uno::Reference
...instead of raw pointer and manual acquire/relase. It is unclear to me why
the original code thought it was necessary (or merely "better") to hold by raw
pointer; but at least from the backtrace in rhbz#1247588, it seems plausible
that UNO method calls through such raw pointers could recursively call into
atk_object_wrapper_dispose and make the raw pointer stale.
Change-Id: Idc0a4f9e2f7ffe610261c1b7b98ce9c5e040db43
Diffstat (limited to 'vcl/unx/gtk/a11y/atktextattributes.cxx')
-rw-r--r-- | vcl/unx/gtk/a11y/atktextattributes.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 484336773906..734200568eae 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -207,23 +207,21 @@ String2Float( uno::Any& rAny, const gchar * value ) /*****************************************************************************/ -static accessibility::XAccessibleComponent* +static css::uno::Reference<css::accessibility::XAccessibleComponent> getComponent( AtkText *pText ) throw (uno::RuntimeException) { AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText ); if( pWrap ) { - if( !pWrap->mpComponent && pWrap->mpContext ) + if( !pWrap->mpComponent.is() ) { - uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleComponent>::get() ); - pWrap->mpComponent = static_cast< accessibility::XAccessibleComponent * > (any.pReserved); - pWrap->mpComponent->acquire(); + pWrap->mpComponent.set(pWrap->mpContext, css::uno::UNO_QUERY); } return pWrap->mpComponent; } - return NULL; + return css::uno::Reference<css::accessibility::XAccessibleComponent>(); } static gchar* @@ -248,8 +246,9 @@ get_color_value(const uno::Sequence< beans::PropertyValue >& rAttributeList, { try { - accessibility::XAccessibleComponent *pComponent = getComponent( text ); - if( pComponent ) + css::uno::Reference<css::accessibility::XAccessibleComponent> + pComponent = getComponent( text ); + if( pComponent.is() ) { switch( attr ) { |