summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/a11y/atkselection.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-08-13 16:58:58 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-08-13 17:08:22 +0200
commit07ebec47da4a096aaab53bf6a90bb219ce29bfbf (patch)
tree55b125e7256c576e19415e319b84ea342aeb7c6b /vcl/unx/gtk/a11y/atkselection.cxx
parentdd8fbd4c8ae18421975f45c7aa7befbf74f0b0d7 (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/atkselection.cxx')
-rw-r--r--vcl/unx/gtk/a11y/atkselection.cxx45
1 files changed, 25 insertions, 20 deletions
diff --git a/vcl/unx/gtk/a11y/atkselection.cxx b/vcl/unx/gtk/a11y/atkselection.cxx
index 50bd94fa69ca..3c75865c6689 100644
--- a/vcl/unx/gtk/a11y/atkselection.cxx
+++ b/vcl/unx/gtk/a11y/atkselection.cxx
@@ -23,23 +23,21 @@
using namespace ::com::sun::star;
-static accessibility::XAccessibleSelection*
+static css::uno::Reference<css::accessibility::XAccessibleSelection>
getSelection( AtkSelection *pSelection ) throw (uno::RuntimeException)
{
AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pSelection );
if( pWrap )
{
- if( !pWrap->mpSelection && pWrap->mpContext )
+ if( !pWrap->mpSelection.is() )
{
- uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleSelection>::get() );
- pWrap->mpSelection = static_cast< accessibility::XAccessibleSelection * > (any.pReserved);
- pWrap->mpSelection->acquire();
+ pWrap->mpSelection.set(pWrap->mpContext, css::uno::UNO_QUERY);
}
return pWrap->mpSelection;
}
- return NULL;
+ return css::uno::Reference<css::accessibility::XAccessibleSelection>();
}
extern "C" {
@@ -49,8 +47,9 @@ selection_add_selection( AtkSelection *selection,
gint i )
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
{
pSelection->selectAccessibleChild( i );
return TRUE;
@@ -67,8 +66,9 @@ static gboolean
selection_clear_selection( AtkSelection *selection )
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
{
pSelection->clearAccessibleSelection();
return TRUE;
@@ -86,8 +86,9 @@ selection_ref_selection( AtkSelection *selection,
gint i )
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
return atk_object_wrapper_ref( pSelection->getSelectedAccessibleChild( i ) );
}
catch(const uno::Exception&) {
@@ -101,8 +102,9 @@ static gint
selection_get_selection_count( AtkSelection *selection)
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
return pSelection->getSelectedAccessibleChildCount();
}
catch(const uno::Exception&) {
@@ -117,8 +119,9 @@ selection_is_child_selected( AtkSelection *selection,
gint i)
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
return pSelection->isAccessibleChildSelected( i );
}
catch(const uno::Exception&) {
@@ -133,8 +136,9 @@ selection_remove_selection( AtkSelection *selection,
gint i )
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
{
pSelection->deselectAccessibleChild( i );
return TRUE;
@@ -151,8 +155,9 @@ static gboolean
selection_select_all_selection( AtkSelection *selection)
{
try {
- accessibility::XAccessibleSelection* pSelection = getSelection( selection );
- if( pSelection )
+ css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
+ = getSelection( selection );
+ if( pSelection.is() )
{
pSelection->selectAllAccessibleChildren();
return TRUE;