[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - vcl/unx

Stephan Bergmann sbergman at redhat.com
Thu Aug 20 06:59:45 PDT 2015


 vcl/unx/gtk/a11y/atkaction.cxx         |   30 +++---
 vcl/unx/gtk/a11y/atkcomponent.cxx      |   37 ++++---
 vcl/unx/gtk/a11y/atkeditabletext.cxx   |   45 +++++----
 vcl/unx/gtk/a11y/atkhypertext.cxx      |   25 ++---
 vcl/unx/gtk/a11y/atkimage.cxx          |   20 ++--
 vcl/unx/gtk/a11y/atklistener.cxx       |   10 +-
 vcl/unx/gtk/a11y/atklistener.hxx       |    4 
 vcl/unx/gtk/a11y/atkregistry.cxx       |    6 -
 vcl/unx/gtk/a11y/atkregistry.hxx       |    3 
 vcl/unx/gtk/a11y/atkselection.cxx      |   45 +++++----
 vcl/unx/gtk/a11y/atktable.cxx          |  139 +++++++++++++++-------------
 vcl/unx/gtk/a11y/atktext.cxx           |  162 +++++++++++++++------------------
 vcl/unx/gtk/a11y/atktextattributes.cxx |   15 +--
 vcl/unx/gtk/a11y/atkutil.cxx           |   22 +---
 vcl/unx/gtk/a11y/atkvalue.cxx          |   30 +++---
 vcl/unx/gtk/a11y/atkwrapper.cxx        |   96 ++++++++-----------
 vcl/unx/gtk/a11y/atkwrapper.hxx        |   31 +++---
 17 files changed, 365 insertions(+), 355 deletions(-)

New commits:
commit 3230d2439cc395cedb4f8fcfd49109bb81306dac
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 13 16:58:58 2015 +0200

    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.
    
    (cherry picked from commit 07ebec47da4a096aaab53bf6a90bb219ce29bfbf)
    
    Conflicts:
    	vcl/unx/gtk/a11y/atkaction.cxx
    	vcl/unx/gtk/a11y/atkcomponent.cxx
    	vcl/unx/gtk/a11y/atkeditabletext.cxx
    	vcl/unx/gtk/a11y/atkhypertext.cxx
    	vcl/unx/gtk/a11y/atkimage.cxx
    	vcl/unx/gtk/a11y/atkregistry.cxx
    	vcl/unx/gtk/a11y/atkselection.cxx
    	vcl/unx/gtk/a11y/atktable.cxx
    	vcl/unx/gtk/a11y/atktext.cxx
    	vcl/unx/gtk/a11y/atktextattributes.cxx
    	vcl/unx/gtk/a11y/atkutil.cxx
    	vcl/unx/gtk/a11y/atkvalue.cxx
    	vcl/unx/gtk/a11y/atkwrapper.cxx
    
    Change-Id: Idc0a4f9e2f7ffe610261c1b7b98ce9c5e040db43
    Reviewed-on: https://gerrit.libreoffice.org/17764
    Tested-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index 01f2365..396643a 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -45,24 +45,22 @@ getAsConst( const OString& rString )
     return aUgly[ nIdx ].getStr();
 }
 
-static accessibility::XAccessibleAction*
+static css::uno::Reference<css::accessibility::XAccessibleAction>
         getAction( AtkAction *action ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( action );
 
     if( pWrap )
     {
-        if( !pWrap->mpAction && pWrap->mpContext )
+        if( !pWrap->mpAction.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleAction>::get() );
-            pWrap->mpAction = reinterpret_cast< accessibility::XAccessibleAction * > (any.pReserved);
-            pWrap->mpAction->acquire();
+            pWrap->mpAction.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpAction;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleAction>();
 }
 
 extern "C" {
@@ -72,8 +70,9 @@ action_wrapper_do_action (AtkAction *action,
                           gint       i)
 {
     try {
-        accessibility::XAccessibleAction* pAction = getAction( action );
-        if( pAction )
+        css::uno::Reference<css::accessibility::XAccessibleAction> pAction
+            = getAction( action );
+        if( pAction.is() )
             return pAction->doAccessibleAction( i );
     }
     catch(const uno::Exception&) {
@@ -87,8 +86,9 @@ static gint
 action_wrapper_get_n_actions (AtkAction *action)
 {
     try {
-        accessibility::XAccessibleAction* pAction = getAction( action );
-        if( pAction )
+        css::uno::Reference<css::accessibility::XAccessibleAction> pAction
+            = getAction( action );
+        if( pAction.is() )
             return pAction->getAccessibleActionCount();
     }
     catch(const uno::Exception&) {
@@ -131,8 +131,9 @@ action_wrapper_get_name (AtkAction *action,
     }
 
     try {
-        accessibility::XAccessibleAction* pAction = getAction( action );
-        if( pAction )
+        css::uno::Reference<css::accessibility::XAccessibleAction> pAction
+            = getAction( action );
+        if( pAction.is() )
         {
             std::map< OUString, const gchar * >::iterator iter;
 
@@ -213,8 +214,9 @@ action_wrapper_get_keybinding (AtkAction *action,
                                gint       i)
 {
     try {
-        accessibility::XAccessibleAction* pAction = getAction( action );
-        if( pAction )
+        css::uno::Reference<css::accessibility::XAccessibleAction> pAction
+            = getAction( action );
+        if( pAction.is() )
         {
             uno::Reference< accessibility::XAccessibleKeyBinding > xBinding( pAction->getAccessibleActionKeyBinding( i ));
 
diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx
index 222f4b6..6dd0259 100644
--- a/vcl/unx/gtk/a11y/atkcomponent.cxx
+++ b/vcl/unx/gtk/a11y/atkcomponent.cxx
@@ -27,29 +27,27 @@
 
 using namespace ::com::sun::star;
 
-static accessibility::XAccessibleComponent*
+static css::uno::Reference<css::accessibility::XAccessibleComponent>
     getComponent( AtkComponent *pComponent ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pComponent );
     if( pWrap )
     {
-        if( !pWrap->mpComponent && pWrap->mpContext )
+        if( !pWrap->mpComponent.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleComponent>::get() );
-            pWrap->mpComponent = reinterpret_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 awt::Point
-translatePoint( accessibility::XAccessibleComponent *pComponent,
+translatePoint( css::uno::Reference<accessibility::XAccessibleComponent> const & pComponent,
                 gint x, gint y, AtkCoordType t)
 {
     awt::Point aOrigin( 0, 0 );
@@ -73,8 +71,9 @@ component_wrapper_grab_focus (AtkComponent *component)
 {
     try
     {
-        accessibility::XAccessibleComponent* pComponent = getComponent( component );
-        if( pComponent )
+        css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
+            = getComponent( component );
+        if( pComponent.is() )
         {
             pComponent->grabFocus();
             return TRUE;
@@ -98,8 +97,9 @@ component_wrapper_contains (AtkComponent *component,
 {
     try
     {
-        accessibility::XAccessibleComponent* pComponent = getComponent( component );
-        if( pComponent )
+        css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
+            = getComponent( component );
+        if( pComponent.is() )
             return pComponent->containsPoint( translatePoint( pComponent, x, y, coord_type ) );
     }
     catch( const uno::Exception & )
@@ -120,9 +120,10 @@ component_wrapper_ref_accessible_at_point (AtkComponent *component,
 {
     try
     {
-        accessibility::XAccessibleComponent* pComponent = getComponent( component );
+        css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
+            = getComponent( component );
 
-        if( pComponent )
+        if( pComponent.is() )
         {
             uno::Reference< accessibility::XAccessible > xAccessible;
             xAccessible = pComponent->getAccessibleAtPoint(
@@ -164,8 +165,9 @@ component_wrapper_get_position (AtkComponent   *component,
 {
     try
     {
-        accessibility::XAccessibleComponent* pComponent = getComponent( component );
-        if( pComponent )
+        css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
+            = getComponent( component );
+        if( pComponent.is() )
         {
             awt::Point aPos;
 
@@ -197,8 +199,9 @@ component_wrapper_get_size (AtkComponent   *component,
 {
     try
     {
-        accessibility::XAccessibleComponent* pComponent = getComponent( component );
-        if( pComponent )
+        css::uno::Reference<css::accessibility::XAccessibleComponent> pComponent
+            = getComponent( component );
+        if( pComponent.is() )
         {
             awt::Size aSize = pComponent->getSize();
             *width = aSize.Width;
diff --git a/vcl/unx/gtk/a11y/atkeditabletext.cxx b/vcl/unx/gtk/a11y/atkeditabletext.cxx
index 2918da6..f1132a8 100644
--- a/vcl/unx/gtk/a11y/atkeditabletext.cxx
+++ b/vcl/unx/gtk/a11y/atkeditabletext.cxx
@@ -28,23 +28,21 @@
 
 using namespace ::com::sun::star;
 
-static accessibility::XAccessibleEditableText*
+static css::uno::Reference<css::accessibility::XAccessibleEditableText>
     getEditableText( AtkEditableText *pEditableText ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pEditableText );
     if( pWrap )
     {
-        if( !pWrap->mpEditableText && pWrap->mpContext )
+        if( !pWrap->mpEditableText.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleEditableText>::get() );
-            pWrap->mpEditableText = reinterpret_cast< accessibility::XAccessibleEditableText * > (any.pReserved);
-            pWrap->mpEditableText->acquire();
+            pWrap->mpEditableText.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpEditableText;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleEditableText>();
 }
 
 /*****************************************************************************/
@@ -58,8 +56,9 @@ editable_text_wrapper_set_run_attributes( AtkEditableText  *text,
                                           gint              nEndOffset)
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
         {
             uno::Sequence< beans::PropertyValue > aAttributeList;
 
@@ -79,8 +78,9 @@ editable_text_wrapper_set_text_contents( AtkEditableText  *text,
                                          const gchar      *string )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
         {
             OUString aString ( string, strlen(string), RTL_TEXTENCODING_UTF8 );
             pEditableText->setText( aString );
@@ -98,8 +98,9 @@ editable_text_wrapper_insert_text( AtkEditableText  *text,
                                    gint             *pos )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
         {
             OUString aString ( string, length, RTL_TEXTENCODING_UTF8 );
             if( pEditableText->insertText( aString, *pos ) )
@@ -117,8 +118,9 @@ editable_text_wrapper_cut_text( AtkEditableText  *text,
                                 gint             end )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
             pEditableText->cutText( start, end );
     }
     catch(const uno::Exception&) {
@@ -132,8 +134,9 @@ editable_text_wrapper_delete_text( AtkEditableText  *text,
                                    gint             end )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
             pEditableText->deleteText( start, end );
     }
     catch(const uno::Exception&) {
@@ -146,8 +149,9 @@ editable_text_wrapper_paste_text( AtkEditableText  *text,
                                   gint             pos )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
             pEditableText->pasteText( pos );
     }
     catch(const uno::Exception&) {
@@ -161,8 +165,9 @@ editable_text_wrapper_copy_text( AtkEditableText  *text,
                                  gint             end )
 {
     try {
-        accessibility::XAccessibleEditableText* pEditableText = getEditableText( text );
-        if( pEditableText )
+        css::uno::Reference<css::accessibility::XAccessibleEditableText>
+            pEditableText = getEditableText( text );
+        if( pEditableText.is() )
             pEditableText->copyText( start, end );
     }
     catch(const uno::Exception&) {
diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx
index c4c5a53..97761d5 100644
--- a/vcl/unx/gtk/a11y/atkhypertext.cxx
+++ b/vcl/unx/gtk/a11y/atkhypertext.cxx
@@ -191,23 +191,21 @@ hyper_link_get_type (void)
 
 // ---------------------- AtkHyperText ----------------------
 
-static accessibility::XAccessibleHypertext*
+static css::uno::Reference<css::accessibility::XAccessibleHypertext>
     getHypertext( AtkHypertext *pHypertext ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pHypertext );
     if( pWrap )
     {
-        if( !pWrap->mpHypertext && pWrap->mpContext )
+        if( !pWrap->mpHypertext.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleHypertext>::get() );
-            pWrap->mpHypertext = reinterpret_cast< accessibility::XAccessibleHypertext * > (any.pReserved);
-            pWrap->mpHypertext->acquire();
+            pWrap->mpHypertext.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpHypertext;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleHypertext>();
 }
 
 static AtkHyperlink *
@@ -215,8 +213,9 @@ hypertext_get_link( AtkHypertext *hypertext,
                     gint          link_index)
 {
     try {
-        accessibility::XAccessibleHypertext* pHypertext = getHypertext( hypertext );
-        if( pHypertext )
+        css::uno::Reference<css::accessibility::XAccessibleHypertext> pHypertext
+            = getHypertext( hypertext );
+        if( pHypertext.is() )
         {
             HyperLink *pLink = (HyperLink *)g_object_new( hyper_link_get_type(), NULL );
             pLink->xLink = pHypertext->getHyperLink( link_index );
@@ -238,8 +237,9 @@ static gint
 hypertext_get_n_links( AtkHypertext *hypertext )
 {
     try {
-        accessibility::XAccessibleHypertext* pHypertext = getHypertext( hypertext );
-        if( pHypertext )
+        css::uno::Reference<css::accessibility::XAccessibleHypertext> pHypertext
+            = getHypertext( hypertext );
+        if( pHypertext.is() )
             return pHypertext->getHyperLinkCount();
     }
     catch(const uno::Exception&) {
@@ -254,8 +254,9 @@ hypertext_get_link_index( AtkHypertext *hypertext,
                           gint          index)
 {
     try {
-        accessibility::XAccessibleHypertext* pHypertext = getHypertext( hypertext );
-        if( pHypertext )
+        css::uno::Reference<css::accessibility::XAccessibleHypertext> pHypertext
+            = getHypertext( hypertext );
+        if( pHypertext.is() )
             return pHypertext->getHyperLinkIndex( index );
     }
     catch(const uno::Exception&) {
diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx
index 3471032..2f81e9c 100644
--- a/vcl/unx/gtk/a11y/atkimage.cxx
+++ b/vcl/unx/gtk/a11y/atkimage.cxx
@@ -37,23 +37,21 @@ getAsConst( const OUString& rString )
     return aUgly[ nIdx ].getStr();
 }
 
-static accessibility::XAccessibleImage*
+static css::uno::Reference<css::accessibility::XAccessibleImage>
     getImage( AtkImage *pImage ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pImage );
     if( pWrap )
     {
-        if( !pWrap->mpImage && pWrap->mpContext )
+        if( !pWrap->mpImage.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleImage>::get() );
-            pWrap->mpImage = reinterpret_cast< accessibility::XAccessibleImage * > (any.pReserved);
-            pWrap->mpImage->acquire();
+            pWrap->mpImage.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpImage;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleImage>();
 }
 
 extern "C" {
@@ -62,8 +60,9 @@ static G_CONST_RETURN gchar *
 image_get_image_description( AtkImage *image )
 {
     try {
-        accessibility::XAccessibleImage* pImage = getImage( image );
-        if( pImage )
+        css::uno::Reference<css::accessibility::XAccessibleImage> pImage
+            = getImage( image );
+        if( pImage.is() )
             return getAsConst( pImage->getAccessibleImageDescription() );
     }
     catch(const uno::Exception&) {
@@ -98,8 +97,9 @@ image_get_image_size( AtkImage *image,
     *width = 0;
     *height = 0;
     try {
-        accessibility::XAccessibleImage* pImage = getImage( image );
-        if( pImage )
+        css::uno::Reference<css::accessibility::XAccessibleImage> pImage
+            = getImage( image );
+        if( pImage.is() )
         {
             *width = pImage->getAccessibleImageWidth();
             *height = pImage->getAccessibleImageHeight();
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index 45c0602..c98c18e 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -118,7 +118,9 @@ static AtkObject *getObjFromAny( const uno::Any &rAny )
 /*****************************************************************************/
 
 // Updates the child list held to provide the old IndexInParent on children_changed::remove
-void AtkListener::updateChildList(accessibility::XAccessibleContext* pContext)
+void AtkListener::updateChildList(
+    css::uno::Reference<css::accessibility::XAccessibleContext> const &
+        pContext)
 {
      m_aChildList.clear();
 
@@ -157,7 +159,7 @@ void AtkListener::handleChildAdded(
 
     if( pChild )
     {
-        updateChildList(rxParent.get());
+        updateChildList(rxParent);
 
         atk_object_wrapper_add_child( mpWrapper, pChild,
             atk_object_get_index_in_parent( pChild ));
@@ -196,7 +198,7 @@ void AtkListener::handleChildRemoved(
     // for now.
     if( nIndex >= 0 )
     {
-        updateChildList(rxParent.get());
+        updateChildList(rxParent);
 
         AtkObject * pChild = atk_object_wrapper_ref( rxChild, false );
         if( pChild )
@@ -227,7 +229,7 @@ void AtkListener::handleInvalidateChildren(
         }
     }
 
-    updateChildList(rxParent.get());
+    updateChildList(rxParent);
 
     // Send notifications for all new children
     size_t nmax = m_aChildList.size();
diff --git a/vcl/unx/gtk/a11y/atklistener.hxx b/vcl/unx/gtk/a11y/atklistener.hxx
index 3255bcf..6488a98 100644
--- a/vcl/unx/gtk/a11y/atklistener.hxx
+++ b/vcl/unx/gtk/a11y/atklistener.hxx
@@ -50,7 +50,9 @@ private:
     virtual ~AtkListener();
 
     // Updates the child list held to provide the old IndexInParent on children_changed::remove
-    void updateChildList(::com::sun::star::accessibility::XAccessibleContext* pContext);
+    void updateChildList(
+        css::uno::Reference<css::accessibility::XAccessibleContext> const &
+            pContext);
 
     // Process CHILD_EVENT notifications with a new child added
     void handleChildAdded(
diff --git a/vcl/unx/gtk/a11y/atkregistry.cxx b/vcl/unx/gtk/a11y/atkregistry.cxx
index 10b76c3..ee7c1de 100644
--- a/vcl/unx/gtk/a11y/atkregistry.cxx
+++ b/vcl/unx/gtk/a11y/atkregistry.cxx
@@ -55,10 +55,12 @@ ooo_wrapper_registry_add(const Reference< XAccessible >& rxAccessible, AtkObject
 /*****************************************************************************/
 
 void
-ooo_wrapper_registry_remove(XAccessible *pAccessible)
+ooo_wrapper_registry_remove(
+    css::uno::Reference<css::accessibility::XAccessible> const & pAccessible)
 {
     if( uno_to_gobject )
-        g_hash_table_remove( uno_to_gobject, (gpointer) pAccessible );
+        g_hash_table_remove(
+            uno_to_gobject, static_cast<gpointer>(pAccessible.get()) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkregistry.hxx b/vcl/unx/gtk/a11y/atkregistry.hxx
index c5f70a8..b25e449 100644
--- a/vcl/unx/gtk/a11y/atkregistry.hxx
+++ b/vcl/unx/gtk/a11y/atkregistry.hxx
@@ -27,7 +27,8 @@ AtkObject * ooo_wrapper_registry_get(const ::com::sun::star::uno::Reference< ::c
 
 void ooo_wrapper_registry_add(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible, AtkObject *obj);
 
-void ooo_wrapper_registry_remove(::com::sun::star::accessibility::XAccessible *pAccessible);
+void ooo_wrapper_registry_remove(
+    css::uno::Reference<css::accessibility::XAccessible> const & pAccessible);
 
 #endif // __ATK_REGISTRY_HXX_
 
diff --git a/vcl/unx/gtk/a11y/atkselection.cxx b/vcl/unx/gtk/a11y/atkselection.cxx
index 016cb03..675f8bd 100644
--- a/vcl/unx/gtk/a11y/atkselection.cxx
+++ b/vcl/unx/gtk/a11y/atkselection.cxx
@@ -25,23 +25,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 = reinterpret_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" {
@@ -51,8 +49,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;
@@ -69,8 +68,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;
@@ -88,8 +88,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&) {
@@ -103,8 +104,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&) {
@@ -119,8 +121,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&) {
@@ -135,8 +138,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;
@@ -153,8 +157,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;
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index 12b598b..18d4760 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -56,23 +56,21 @@ getAsConst( const OUString& rString )
 
 /*****************************************************************************/
 
-static accessibility::XAccessibleTable*
+static css::uno::Reference<css::accessibility::XAccessibleTable>
     getTable( AtkTable *pTable ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pTable );
     if( pWrap )
     {
-        if( !pWrap->mpTable && pWrap->mpContext )
+        if( !pWrap->mpTable.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleTable>::get() );
-            pWrap->mpTable = reinterpret_cast< accessibility::XAccessibleTable * > (any.pReserved);
-            pWrap->mpTable->acquire();
+            pWrap->mpTable.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpTable;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleTable>();
 }
 
 /*****************************************************************************/
@@ -85,10 +83,10 @@ table_wrapper_ref_at (AtkTable *table,
                       gint      column)
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleCellAt( %u, %u ) returns", row, column );
 
         if( column >= 255 )
@@ -96,7 +94,7 @@ table_wrapper_ref_at (AtkTable *table,
 
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return atk_object_wrapper_conditional_ref( pTable->getAccessibleCellAt( row, column ) );
     }
 
@@ -115,15 +113,16 @@ table_wrapper_get_index_at (AtkTable      *table,
                             gint          column)
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleIndex( %u, %u ) returns %u\n",
                 row, column, pTable->getAccessibleIndex( row, column ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleIndex( row, column );
     }
     catch(const uno::Exception&) {
@@ -140,15 +139,16 @@ table_wrapper_get_column_at_index (AtkTable      *table,
                                    gint          nIndex)
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleColumn( %u ) returns %u\n",
                 nIndex, pTable->getAccessibleColumn( nIndex ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleColumn( nIndex );
     }
     catch(const uno::Exception&) {
@@ -165,15 +165,16 @@ table_wrapper_get_row_at_index( AtkTable *table,
                                 gint      nIndex )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleRow( %u ) returns %u\n",
                 nIndex, pTable->getAccessibleRow( nIndex ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleRow( nIndex );
     }
     catch(const uno::Exception&) {
@@ -189,15 +190,16 @@ static gint
 table_wrapper_get_n_columns( AtkTable *table )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "XAccessibleTable::getAccessibleColumnCount returns %u\n",
                 pTable->getAccessibleColumnCount() );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleColumnCount();
     }
     catch(const uno::Exception&) {
@@ -213,15 +215,16 @@ static gint
 table_wrapper_get_n_rows( AtkTable *table )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleRowCount() returns %u\n",
                 pTable->getAccessibleRowCount() );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleRowCount();
     }
     catch(const uno::Exception&) {
@@ -239,15 +242,16 @@ table_wrapper_get_column_extent_at( AtkTable *table,
                                     gint      column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleColumnExtentAt( %u, %u ) returns %u\n",
                 row, column, pTable->getAccessibleColumnExtentAt( row, column ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleColumnExtentAt( row, column );
     }
     catch(const uno::Exception&) {
@@ -265,15 +269,16 @@ table_wrapper_get_row_extent_at( AtkTable *table,
                                  gint      column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleRowExtentAt( %u, %u ) returns %u\n",
                 row, column, pTable->getAccessibleRowExtentAt( row, column ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->getAccessibleRowExtentAt( row, column );
     }
     catch(const uno::Exception&) {
@@ -289,14 +294,15 @@ static AtkObject *
 table_wrapper_get_caption( AtkTable *table )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleCaption() returns" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return atk_object_wrapper_conditional_ref( pTable->getAccessibleCaption() );
     }
 
@@ -314,15 +320,16 @@ table_wrapper_get_row_description( AtkTable *table,
                                    gint      row )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleRowDescription( %u ) returns %s\n",
                 row, getAsConst( pTable->getAccessibleRowDescription( row ) ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return getAsConst( pTable->getAccessibleRowDescription( row ) );
     }
     catch(const uno::Exception&) {
@@ -339,15 +346,16 @@ table_wrapper_get_column_description( AtkTable *table,
                                       gint      column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleColumnDescription( %u ) returns %s\n",
                 column, getAsConst( pTable->getAccessibleColumnDescription( column ) ) );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return getAsConst( pTable->getAccessibleColumnDescription( column ) );
     }
     catch(const uno::Exception&) {
@@ -364,8 +372,9 @@ table_wrapper_get_row_header( AtkTable *table,
                               gint      row )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
-        if( pTable )
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
+        if( pTable.is() )
         {
             uno::Reference< accessibility::XAccessibleTable > xRowHeaders( pTable->getAccessibleRowHeaders() );
 
@@ -395,9 +404,9 @@ table_wrapper_get_column_header( AtkTable *table,
                                  gint      column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
-
-        if( pTable )
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
+        if( pTable.is() )
         {
             uno::Reference< accessibility::XAccessibleTable > xColumnHeaders( pTable->getAccessibleColumnHeaders() );
 
@@ -426,14 +435,15 @@ static AtkObject *
 table_wrapper_get_summary( AtkTable *table )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getAccessibleSummary() returns" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
         {
             return atk_object_wrapper_conditional_ref( pTable->getAccessibleSummary() );
         }
@@ -469,14 +479,15 @@ table_wrapper_get_selected_columns( AtkTable      *table,
 {
     *pSelected = NULL;
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getSelectedAccessibleColumns() \n" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return convertToGIntArray( pTable->getSelectedAccessibleColumns(), pSelected );
     }
     catch(const uno::Exception&) {
@@ -494,14 +505,15 @@ table_wrapper_get_selected_rows( AtkTable      *table,
 {
     *pSelected = NULL;
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "getSelectedAccessibleRows() \n" );
 #endif
 
-        if( pTable )
+            = getTable( table );
+        if( pTable.is() )
             return convertToGIntArray( pTable->getSelectedAccessibleRows(), pSelected );
     }
     catch(const uno::Exception&) {
@@ -518,15 +530,16 @@ table_wrapper_is_column_selected( AtkTable      *table,
                                   gint          column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "isAccessibleColumnSelected( %u ) returns %s\n",
                 column, pTable->isAccessibleColumnSelected( column ) ? "true" : "false" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->isAccessibleColumnSelected( column );
     }
     catch(const uno::Exception&) {
@@ -543,15 +556,16 @@ table_wrapper_is_row_selected( AtkTable      *table,
                                gint          row )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "isAccessibleRowSelected( %u ) returns %s\n",
                 row, pTable->isAccessibleRowSelected( row ) ? "true" : "false" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->isAccessibleRowSelected( row );
     }
     catch(const uno::Exception&) {
@@ -569,15 +583,16 @@ table_wrapper_is_selected( AtkTable      *table,
                            gint          column )
 {
     try {
-        accessibility::XAccessibleTable* pTable = getTable( table );
+        css::uno::Reference<css::accessibility::XAccessibleTable> pTable
+            = getTable( table );
 
 #ifdef ENABLE_TRACING
-        if( pTable )
+        if( pTable.is() )
             fprintf(stderr, "isAccessibleSelected( %u, %u ) returns %s\n",
                 row, column, pTable->isAccessibleSelected( row , column ) ? "true" : "false" );
 #endif
 
-        if( pTable )
+        if( pTable.is() )
             return pTable->isAccessibleSelected( row, column );
     }
     catch(const uno::Exception&) {
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index 35187ba..70712a2 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -63,7 +63,7 @@ text_type_from_boundary(AtkTextBoundary boundary_type)
 /*****************************************************************************/
 
 static gchar *
-adjust_boundaries( accessibility::XAccessibleText* pText,
+adjust_boundaries( css::uno::Reference<css::accessibility::XAccessibleText> const & pText,
                    accessibility::TextSegment& rTextSegment,
                    AtkTextBoundary  boundary_type,
                    gint * start_offset, gint * end_offset )
@@ -145,108 +145,78 @@ adjust_boundaries( accessibility::XAccessibleText* pText,
 
 /*****************************************************************************/
 
-static accessibility::XAccessibleText*
+static css::uno::Reference<css::accessibility::XAccessibleText>
     getText( AtkText *pText ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
     if( pWrap )
     {
-        if( !pWrap->mpText && pWrap->mpContext )
+        if( !pWrap->mpText.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleText>::get() );
-            pWrap->mpText = reinterpret_cast< accessibility::XAccessibleText * > (any.pReserved);
-            pWrap->mpText->acquire();
+            pWrap->mpText.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpText;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleText>();
 }
 
 /*****************************************************************************/
 
-static accessibility::XAccessibleTextMarkup*
+static css::uno::Reference<css::accessibility::XAccessibleTextMarkup>
     getTextMarkup( AtkText *pText ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
     if( pWrap )
     {
-        if( !pWrap->mpTextMarkup && pWrap->mpContext )
+        if( !pWrap->mpTextMarkup.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleTextMarkup>::get() );
-            /* Since this not a dedicated interface in Atk and thus has not
-             * been queried during wrapper initialization, we need to check
-             * the return value here.
-             */
-            if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass )
-            {
-                pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved);
-                if( pWrap->mpTextMarkup )
-                    pWrap->mpTextMarkup->acquire();
-            }
+            pWrap->mpTextMarkup.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpTextMarkup;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleTextMarkup>();
 }
 
 /*****************************************************************************/
 
-static accessibility::XAccessibleTextAttributes*
+static css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
     getTextAttributes( AtkText *pText ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
     if( pWrap )
     {
-        if( !pWrap->mpTextAttributes && pWrap->mpContext )
+        if( !pWrap->mpTextAttributes.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleTextAttributes>::get() );
-            /* Since this not a dedicated interface in Atk and thus has not
-             * been queried during wrapper initialization, we need to check
-             * the return value here.
-             */
-            if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass )
-            {
-                pWrap->mpTextAttributes = reinterpret_cast< accessibility::XAccessibleTextAttributes * > (any.pReserved);
-                pWrap->mpTextAttributes->acquire();
-            }
+            pWrap->mpTextAttributes.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpTextAttributes;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleTextAttributes>();
 }
 
 /*****************************************************************************/
 
-static accessibility::XAccessibleMultiLineText*
+static css::uno::Reference<css::accessibility::XAccessibleMultiLineText>
     getMultiLineText( AtkText *pText ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pText );
     if( pWrap )
     {
-        if( !pWrap->mpMultiLineText && pWrap->mpContext )
+        if( !pWrap->mpMultiLineText.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleMultiLineText>::get() );
-            /* Since this not a dedicated interface in Atk and thus has not
-             * been queried during wrapper initialization, we need to check
-             * the return value here.
-             */
-            if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass )
-            {
-                pWrap->mpMultiLineText = reinterpret_cast< accessibility::XAccessibleMultiLineText * > (any.pReserved);
-                pWrap->mpMultiLineText->acquire();
-            }
+            pWrap->mpMultiLineText.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpMultiLineText;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleMultiLineText>();
 }
 
 /*****************************************************************************/
@@ -281,8 +251,9 @@ text_wrapper_get_text (AtkText *text,
     }
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             OUString aText;
             sal_Int32 n = pText->getCharacterCount();
@@ -313,8 +284,9 @@ text_wrapper_get_text_after_offset (AtkText          *text,
                                     gint             *end_offset)
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             accessibility::TextSegment aTextSegment = pText->getTextBehindIndex(offset, text_type_from_boundary(boundary_type));
             return adjust_boundaries(pText, aTextSegment, boundary_type, start_offset, end_offset);
@@ -335,8 +307,9 @@ text_wrapper_get_text_at_offset (AtkText          *text,
                                  gint             *end_offset)
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             /* If the user presses the 'End' key, the caret will be placed behind the last character,
              * which is the same index as the first character of the next line. In atk the magic offset
@@ -348,8 +321,10 @@ text_wrapper_get_text_at_offset (AtkText          *text,
                       ATK_TEXT_BOUNDARY_LINE_END == boundary_type)
                )
             {
-                accessibility::XAccessibleMultiLineText* pMultiLineText = getMultiLineText( text );
-                if( pMultiLineText )
+                css::uno::Reference<
+                    css::accessibility::XAccessibleMultiLineText> pMultiLineText
+                        = getMultiLineText( text );
+                if( pMultiLineText.is() )
                 {
                     accessibility::TextSegment aTextSegment = pMultiLineText->getTextAtLineWithCaret();
                     return adjust_boundaries(pText, aTextSegment, boundary_type, start_offset, end_offset);
@@ -394,8 +369,9 @@ text_wrapper_get_text_before_offset (AtkText          *text,
                                      gint             *end_offset)
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             accessibility::TextSegment aTextSegment = pText->getTextBeforeIndex(offset, text_type_from_boundary(boundary_type));
             return adjust_boundaries(pText, aTextSegment, boundary_type, start_offset, end_offset);
@@ -414,8 +390,9 @@ text_wrapper_get_caret_offset (AtkText          *text)
     gint offset = -1;
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             offset = pText->getCaretPosition();
     }
     catch(const uno::Exception&) {
@@ -434,8 +411,9 @@ text_wrapper_set_caret_offset (AtkText *text,
                                gint     offset)
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             return pText->setCaretPosition( offset );
     }
     catch(const uno::Exception&) {
@@ -447,7 +425,7 @@ text_wrapper_set_caret_offset (AtkText *text,
 
 // #i92232#
 AtkAttributeSet*
-handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup,
+handle_text_markup_as_run_attribute( css::uno::Reference<css::accessibility::XAccessibleTextMarkup> const & pTextMarkup,
                                      const gint nTextMarkupType,
                                      const gint offset,
                                      AtkAttributeSet* pSet,
@@ -533,9 +511,11 @@ text_wrapper_get_run_attributes( AtkText        *text,
     try {
         bool bOffsetsAreValid = false;
 
-        accessibility::XAccessibleText* pText = getText( text );
-        accessibility::XAccessibleTextAttributes* pTextAttributes = getTextAttributes( text );
-        if( pText && pTextAttributes )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
+            pTextAttributes = getTextAttributes( text );
+        if( pText.is() && pTextAttributes.is() )
         {
             uno::Sequence< beans::PropertyValue > aAttributeList =
                 pTextAttributes->getRunAttributes( offset, uno::Sequence< OUString > () );
@@ -559,11 +539,12 @@ text_wrapper_get_run_attributes( AtkText        *text,
         // #i92232#
         // - add special handling for tracked changes and refactor the
         //   corresponding code for handling misspelled text.
-        accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text );
-        if( pTextMarkup )
+        css::uno::Reference<css::accessibility::XAccessibleTextMarkup>
+            pTextMarkup = getTextMarkup( text );
+        if( pTextMarkup.is() )
         {
             // Get attribute run here if it hasn't been done before
-            if (!bOffsetsAreValid && pText)
+            if (!bOffsetsAreValid && pText.is())
             {
                 accessibility::TextSegment aAttributeTextSegment =
                     pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
@@ -612,8 +593,9 @@ text_wrapper_get_default_attributes( AtkText *text )
     AtkAttributeSet *pSet = NULL;
 
     try {
-        accessibility::XAccessibleTextAttributes* pTextAttributes = getTextAttributes( text );
-        if( pTextAttributes )
+        css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
+            pTextAttributes = getTextAttributes( text );
+        if( pTextAttributes.is() )
         {
             uno::Sequence< beans::PropertyValue > aAttributeList =
                 pTextAttributes->getDefaultAttributes( uno::Sequence< OUString > () );
@@ -647,8 +629,9 @@ text_wrapper_get_character_extents( AtkText          *text,
                                     AtkCoordType      coords )
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             *x = *y = *width = *height = 0;
             awt::Rectangle aRect = pText->getCharacterBounds( offset );
@@ -686,8 +669,9 @@ text_wrapper_get_character_count (AtkText *text)
     gint rv = 0;
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             rv = pText->getCharacterCount();
     }
     catch(const uno::Exception&) {
@@ -708,8 +692,9 @@ text_wrapper_get_offset_at_point (AtkText     *text,
                                   AtkCoordType coords)
 {
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             gint origin_x = 0;
             gint origin_y = 0;
@@ -740,8 +725,9 @@ text_wrapper_get_n_selections (AtkText *text)
     gint rv = 0;
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             rv = ( pText->getSelectionEnd() > pText->getSelectionStart() ) ? 1 : 0;
     }
     catch(const uno::Exception&) {
@@ -764,8 +750,9 @@ text_wrapper_get_selection (AtkText *text,
     g_return_val_if_fail( selection_num == 0, FALSE );
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
         {
             *start_offset = pText->getSelectionStart();
             *end_offset   = pText->getSelectionEnd();
@@ -789,8 +776,9 @@ text_wrapper_add_selection (AtkText *text,
     //        existing adjacent selection ?
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             return pText->setSelection( start_offset, end_offset ); // ?
     }
     catch(const uno::Exception&) {
@@ -807,8 +795,9 @@ text_wrapper_remove_selection (AtkText *text,
     g_return_val_if_fail( selection_num == 0, FALSE );
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             return pText->setSelection( 0, 0 ); // ?
     }
     catch(const uno::Exception&) {
@@ -827,8 +816,9 @@ text_wrapper_set_selection (AtkText *text,
     g_return_val_if_fail( selection_num == 0, FALSE );
 
     try {
-        accessibility::XAccessibleText* pText = getText( text );
-        if( pText )
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
             return pText->setSelection( start_offset, end_offset );
     }
     catch(const uno::Exception&) {
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index ec09a2b..0938472 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 = reinterpret_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 )
                 {
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index fb0d258..44b51bc 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -94,23 +94,17 @@ atk_wrapper_focus_idle_handler (gpointer data)
             // also emit state-changed:focused event under the same condition.
             {
                 AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj);
-                if( wrapper_obj && !wrapper_obj->mpText && wrapper_obj->mpContext )
+                if( wrapper_obj && !wrapper_obj->mpText.is() )
                 {
-                    uno::Any any = wrapper_obj->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleText>::get() );
-                    if ( typelib_TypeClass_INTERFACE == any.pType->eTypeClass &&
-                         any.pReserved != 0 )
+                    wrapper_obj->mpText.set(wrapper_obj->mpContext, css::uno::UNO_QUERY);
+                    if ( wrapper_obj->mpText.is() )
                     {
-                        wrapper_obj->mpText = reinterpret_cast< accessibility::XAccessibleText * > (any.pReserved);
-                        if ( wrapper_obj->mpText != 0 )
+                        gint caretPos = wrapper_obj->mpText->getCaretPosition();
+
+                        if ( caretPos != -1 )
                         {
-                            wrapper_obj->mpText->acquire();
-                            gint caretPos = wrapper_obj->mpText->getCaretPosition();
-
-                            if ( caretPos != -1 )
-                            {
-                                atk_object_notify_state_change( atk_obj, ATK_STATE_FOCUSED, TRUE );
-                                g_signal_emit_by_name( atk_obj, "text_caret_moved", caretPos );
-                            }
+                            atk_object_notify_state_change( atk_obj, ATK_STATE_FOCUSED, TRUE );
+                            g_signal_emit_by_name( atk_obj, "text_caret_moved", caretPos );
                         }
                     }
                 }
diff --git a/vcl/unx/gtk/a11y/atkvalue.cxx b/vcl/unx/gtk/a11y/atkvalue.cxx
index 7e1256e..714ffe2 100644
--- a/vcl/unx/gtk/a11y/atkvalue.cxx
+++ b/vcl/unx/gtk/a11y/atkvalue.cxx
@@ -26,23 +26,21 @@
 
 using namespace ::com::sun::star;
 
-static accessibility::XAccessibleValue*
+static css::uno::Reference<css::accessibility::XAccessibleValue>
     getValue( AtkValue *pValue ) throw (uno::RuntimeException)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pValue );
     if( pWrap )
     {
-        if( !pWrap->mpValue && pWrap->mpContext )
+        if( !pWrap->mpValue.is() )
         {
-            uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleValue>::get() );
-            pWrap->mpValue = reinterpret_cast< accessibility::XAccessibleValue * > (any.pReserved);
-            pWrap->mpValue->acquire();
+            pWrap->mpValue.set(pWrap->mpContext, css::uno::UNO_QUERY);
         }
 
         return pWrap->mpValue;
     }
 
-    return NULL;
+    return css::uno::Reference<css::accessibility::XAccessibleValue>();
 }
 
 static void anyToGValue( uno::Any aAny, GValue *pValue )
@@ -63,8 +61,9 @@ value_wrapper_get_current_value( AtkValue *value,
                                  GValue   *gval )
 {
     try {
-        accessibility::XAccessibleValue* pValue = getValue( value );
-        if( pValue )
+        css::uno::Reference<css::accessibility::XAccessibleValue> pValue
+            = getValue( value );
+        if( pValue.is() )
             anyToGValue( pValue->getCurrentValue(), gval );
     }
     catch(const uno::Exception&) {
@@ -77,8 +76,9 @@ value_wrapper_get_maximum_value( AtkValue *value,
                                  GValue   *gval )
 {
     try {
-        accessibility::XAccessibleValue* pValue = getValue( value );
-        if( pValue )
+        css::uno::Reference<css::accessibility::XAccessibleValue> pValue
+            = getValue( value );
+        if( pValue.is() )
             anyToGValue( pValue->getMaximumValue(), gval );
     }
     catch(const uno::Exception&) {
@@ -91,8 +91,9 @@ value_wrapper_get_minimum_value( AtkValue *value,
                                  GValue   *gval )
 {
     try {
-        accessibility::XAccessibleValue* pValue = getValue( value );
-        if( pValue )
+        css::uno::Reference<css::accessibility::XAccessibleValue> pValue
+            = getValue( value );
+        if( pValue.is() )
             anyToGValue( pValue->getMinimumValue(), gval );
     }
     catch(const uno::Exception&) {
@@ -105,8 +106,9 @@ value_wrapper_set_current_value( AtkValue     *value,
                                  const GValue *gval )
 {
     try {
-        accessibility::XAccessibleValue* pValue = getValue( value );
-        if( pValue )
+        css::uno::Reference<css::accessibility::XAccessibleValue> pValue
+            = getValue( value );
+        if( pValue.is() )
         {
             // FIXME - this needs expanding
             double aDouble = g_value_get_double( gval );
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index f19c7e8..c3e0033 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -342,13 +342,12 @@ wrapper_get_name( AtkObject *atk_obj )
 {
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
             OString aName =
                 OUStringToOString(
-                    xContext->getAccessibleName(),
+                    obj->mpContext->getAccessibleName(),
                     RTL_TEXTENCODING_UTF8);
 
             int nCmp = atk_obj->name ? rtl_str_compare( atk_obj->name, aName.getStr() ) : -1;
@@ -374,13 +373,12 @@ wrapper_get_description( AtkObject *atk_obj )
 {
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
             OString aDescription =
                 OUStringToOString(
-                    xContext->getAccessibleDescription(),
+                    obj->mpContext->getAccessibleDescription(),
                     RTL_TEXTENCODING_UTF8);
 
             g_free(atk_obj->description);
@@ -403,20 +401,16 @@ wrapper_get_attributes( AtkObject *atk_obj )
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER( atk_obj );
     AtkAttributeSet *pSet = NULL;
 
-    if( obj->mpContext )
+    try
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext( obj->mpContext );
-        try
-        {
-            uno::Reference< accessibility::XAccessibleExtendedAttributes > xExtendedAttrs( xContext,
-                                                                                           uno::UNO_QUERY );
-            if( xExtendedAttrs.is() )
-                pSet = attribute_set_new_from_extended_attributes( xExtendedAttrs );
-        }
-        catch(const uno::Exception&)
-        {
-            g_warning( "Exception in getAccessibleAttributes()" );
-        }
+        uno::Reference< accessibility::XAccessibleExtendedAttributes >
+            xExtendedAttrs( obj->mpContext, uno::UNO_QUERY );
+        if( xExtendedAttrs.is() )
+            pSet = attribute_set_new_from_extended_attributes( xExtendedAttrs );
+    }
+    catch(const uno::Exception&)
+    {
+        g_warning( "Exception in getAccessibleAttributes()" );
     }
 
     return pSet;
@@ -430,11 +424,10 @@ wrapper_get_n_children( AtkObject *atk_obj )
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
     gint n = 0;
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
-            n = xContext->getAccessibleChildCount();
+            n = obj->mpContext->getAccessibleChildCount();
         }
         catch(const uno::Exception&) {
             OSL_FAIL("Exception in getAccessibleChildCount()" );
@@ -460,12 +453,11 @@ wrapper_ref_child( AtkObject *atk_obj,
         return obj->child_about_to_be_removed;
     }
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
             uno::Reference< accessibility::XAccessible > xAccessible =
-                xContext->getAccessibleChild( i );
+                obj->mpContext->getAccessibleChild( i );
 
             child = atk_object_wrapper_ref( xAccessible );
         }
@@ -485,11 +477,10 @@ wrapper_get_index_in_parent( AtkObject *atk_obj )
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
     gint i = -1;
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
-            i = xContext->getAccessibleIndexInParent();
+            i = obj->mpContext->getAccessibleIndexInParent();
 
 #ifdef ENABLE_TRACING
             fprintf(stderr, "%p->getAccessibleIndexInParent() returned: %u\n",
@@ -511,12 +502,11 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
     AtkRelationSet *pSet = atk_relation_set_new();
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
             uno::Reference< accessibility::XAccessibleRelationSet > xRelationSet(
-                    xContext->getAccessibleRelationSet()
+                    obj->mpContext->getAccessibleRelationSet()
             );
 
             sal_Int32 nRelations = xRelationSet.is() ? xRelationSet->getRelationCount() : 0;
@@ -557,12 +547,11 @@ wrapper_ref_state_set( AtkObject *atk_obj )
     AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
     AtkStateSet *pSet = atk_state_set_new();
 
-    if( obj->mpContext )
+    if( obj->mpContext.is() )
     {
-        uno::Reference< accessibility::XAccessibleContext > xContext(obj->mpContext);
         try {
             uno::Reference< accessibility::XAccessibleStateSet > xStateSet(
-                xContext->getAccessibleStateSet());
+                obj->mpContext->getAccessibleStateSet());
 
             if( xStateSet.is() )
             {
@@ -604,11 +593,10 @@ atk_object_wrapper_finalize (GObject *obj)
 {
     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER (obj);
 
-    if( pWrap->mpAccessible )
+    if( pWrap->mpAccessible.is() )
     {
         ooo_wrapper_registry_remove( pWrap->mpAccessible );
-        pWrap->mpAccessible->release();
-        pWrap->mpAccessible = NULL;
+        pWrap->mpAccessible.clear();
     }
 
     atk_object_wrapper_dispose( pWrap );
@@ -835,14 +823,12 @@ atk_object_wrapper_new( const ::com::sun::star::uno::Reference< ::com::sun::star
         gpointer obj = g_object_new( nType, NULL);
 
         pWrap = ATK_OBJECT_WRAPPER( obj );
-        pWrap->mpAccessible = rxAccessible.get();
-        rxAccessible->acquire();
+        pWrap->mpAccessible = rxAccessible;
 
         pWrap->index_of_child_about_to_be_removed = -1;
         pWrap->child_about_to_be_removed = NULL;
 
-        xContext->acquire();
-        pWrap->mpContext = xContext.get();
+        pWrap->mpContext = xContext;
 
         AtkObject* atk_obj = ATK_OBJECT(pWrap);
         atk_obj->role = mapToAtkRole( xContext->getAccessibleRole() );
@@ -924,23 +910,21 @@ void atk_object_wrapper_set_role(AtkObjectWrapper* wrapper, sal_Int16 role)
 
 /*****************************************************************************/
 
-#define RELEASE(i) if( i ) { i->release(); i = NULL; }
-
 void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper)
 {
-    RELEASE( wrapper->mpContext )
-    RELEASE( wrapper->mpAction )
-    RELEASE( wrapper->mpComponent )
-    RELEASE( wrapper->mpEditableText )
-    RELEASE( wrapper->mpHypertext )
-    RELEASE( wrapper->mpImage )
-    RELEASE( wrapper->mpSelection )
-    RELEASE( wrapper->mpMultiLineText )
-    RELEASE( wrapper->mpTable )
-    RELEASE( wrapper->mpText )
-    RELEASE( wrapper->mpTextMarkup )
-    RELEASE( wrapper->mpTextAttributes )
-    RELEASE( wrapper->mpValue )
+    wrapper->mpContext.clear();
+    wrapper->mpAction.clear();
+    wrapper->mpComponent.clear();
+    wrapper->mpEditableText.clear();
+    wrapper->mpHypertext.clear();
+    wrapper->mpImage.clear();
+    wrapper->mpSelection.clear();
+    wrapper->mpMultiLineText.clear();
+    wrapper->mpTable.clear();
+    wrapper->mpText.clear();
+    wrapper->mpTextMarkup.clear();
+    wrapper->mpTextAttributes.clear();
+    wrapper->mpValue.clear();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index 5886674..976cabc 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -47,20 +47,23 @@ struct _AtkObjectWrapper
 {
     AtkObject aParent;
 
-    ::com::sun::star::accessibility::XAccessible               *mpAccessible;
-    ::com::sun::star::accessibility::XAccessibleContext        *mpContext;
-    ::com::sun::star::accessibility::XAccessibleAction         *mpAction;
-    ::com::sun::star::accessibility::XAccessibleComponent      *mpComponent;
-    ::com::sun::star::accessibility::XAccessibleEditableText   *mpEditableText;
-    ::com::sun::star::accessibility::XAccessibleHypertext      *mpHypertext;
-    ::com::sun::star::accessibility::XAccessibleImage          *mpImage;
-    ::com::sun::star::accessibility::XAccessibleMultiLineText  *mpMultiLineText;
-    ::com::sun::star::accessibility::XAccessibleSelection      *mpSelection;
-    ::com::sun::star::accessibility::XAccessibleTable          *mpTable;
-    ::com::sun::star::accessibility::XAccessibleText           *mpText;
-    ::com::sun::star::accessibility::XAccessibleTextMarkup     *mpTextMarkup;
-    ::com::sun::star::accessibility::XAccessibleTextAttributes *mpTextAttributes;
-    ::com::sun::star::accessibility::XAccessibleValue          *mpValue;
+    css::uno::Reference<css::accessibility::XAccessible> mpAccessible;
+    css::uno::Reference<css::accessibility::XAccessibleContext> mpContext;
+    css::uno::Reference<css::accessibility::XAccessibleAction> mpAction;
+    css::uno::Reference<css::accessibility::XAccessibleComponent> mpComponent;
+    css::uno::Reference<css::accessibility::XAccessibleEditableText>
+        mpEditableText;
+    css::uno::Reference<css::accessibility::XAccessibleHypertext> mpHypertext;
+    css::uno::Reference<css::accessibility::XAccessibleImage> mpImage;
+    css::uno::Reference<css::accessibility::XAccessibleMultiLineText>
+        mpMultiLineText;
+    css::uno::Reference<css::accessibility::XAccessibleSelection> mpSelection;
+    css::uno::Reference<css::accessibility::XAccessibleTable> mpTable;
+    css::uno::Reference<css::accessibility::XAccessibleText> mpText;
+    css::uno::Reference<css::accessibility::XAccessibleTextMarkup> mpTextMarkup;
+    css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
+        mpTextAttributes;
+    css::uno::Reference<css::accessibility::XAccessibleValue> mpValue;
 
     AtkObject *child_about_to_be_removed;
     gint       index_of_child_about_to_be_removed;


More information about the Libreoffice-commits mailing list