vcl/inc/graphic/UnoGraphic.hxx              |    1 -
 vcl/inc/graphic/UnoGraphicDescriptor.hxx    |    3 +--
 vcl/source/graphic/UnoGraphic.cxx           |   14 ++++----------
 vcl/source/graphic/UnoGraphicDescriptor.cxx |   14 ++++----------
 4 files changed, 9 insertions(+), 23 deletions(-)

New commits:
commit 8be6e5dcba0fd262421c59364a463e87ef85fe74
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Jan 20 13:30:28 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Jan 20 14:34:40 2023 +0000

    Base GraphicDescriptor on OWeakObject
    
    ...rather than on the legacy OWeakAggObject.
    
    It was found that e.g. Graphic, deriving from GraphicDescriptor, was
    implementing queryInterface in a way that is incompatible with XAggregation
    protocol inherited via OWeakAggObject.  It looks like no code actually made 
use
    of the XAggregation offered by this class hierarchy, so the easiest fix for 
that
    queryInterface implementation appears to switch from OWeakAggObject to
    OWeakObject.
    
    Change-Id: I54514db32b731b9fa83831a1071da6f665fdf25e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145891
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index 7ab50a0b903d..0e2f2af7b1b0 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -45,7 +45,6 @@ public:
     void init(const ::Graphic& rGraphic);
 
     // XInterface
-    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & 
rType ) override;
     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
     virtual void SAL_CALL acquire() noexcept override;
     virtual void SAL_CALL release() noexcept override;
diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx 
b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
index 096b30fd694e..d57bb3a65d28 100644
--- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx
+++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
@@ -61,7 +61,7 @@ class Graphic;
 
 namespace unographic {
 
-class GraphicDescriptor : public ::cppu::OWeakAggObject,
+class GraphicDescriptor : public ::cppu::OWeakObject,
                           public css::lang::XServiceInfo,
                           public css::lang::XTypeProvider,
                           public ::comphelper::PropertySetHelper
@@ -78,7 +78,6 @@ public:
     static rtl::Reference<::comphelper::PropertySetInfo> 
createPropertySetInfo();
 
     // XInterface
-    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & 
rType ) override;
     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
     virtual void SAL_CALL acquire() noexcept override;
     virtual void SAL_CALL release() noexcept override;
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index a1150e26ca69..f26640563862 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -50,7 +50,7 @@ void Graphic::init(const ::Graphic& rGraphic)
     unographic::GraphicDescriptor::init(maGraphic);
 }
 
-uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType )
+uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType )
 {
     uno::Any aAny;
     if( rType == cppu::UnoType<graphic::XGraphic>::get())
@@ -59,20 +59,14 @@ uno::Any SAL_CALL Graphic::queryAggregation( const 
uno::Type& rType )
         aAny <<= uno::Reference< awt::XBitmap >( this );
     else if( rType == cppu::UnoType<lang::XUnoTunnel>::get())
         aAny <<= uno::Reference< lang::XUnoTunnel >(this);
+    else if( rType == cppu::UnoType<graphic::XGraphicTransformer>::get())
+        aAny <<= uno::Reference< graphic::XGraphicTransformer >(this);
     else
-        aAny = ::unographic::GraphicDescriptor::queryAggregation( rType );
+        aAny = ::unographic::GraphicDescriptor::queryInterface( rType );
 
     return aAny;
 }
 
-uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType )
-{
-    css::uno::Any aReturn = ::unographic::GraphicDescriptor::queryInterface( 
rType );
-    if ( !aReturn.hasValue() )
-        aReturn = ::cppu::queryInterface ( rType, static_cast< 
graphic::XGraphicTransformer*>( this ) );
-    return aReturn;
-}
-
 void SAL_CALL Graphic::acquire()
     noexcept
 {
diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx 
b/vcl/source/graphic/UnoGraphicDescriptor.cxx
index b9daeeab6b61..40f205bfdb64 100644
--- a/vcl/source/graphic/UnoGraphicDescriptor.cxx
+++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx
@@ -157,7 +157,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const 
OUString* pURL )
 }
 
 
-uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType 
)
+uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType )
 {
     uno::Any aAny;
 
@@ -172,29 +172,23 @@ uno::Any SAL_CALL GraphicDescriptor::queryAggregation( 
const uno::Type & rType )
     else if( rType == cppu::UnoType<beans::XMultiPropertySet>::get())
         aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
     else
-        aAny = OWeakAggObject::queryAggregation( rType );
+        aAny = OWeakObject::queryInterface( rType );
 
     return aAny;
 }
 
 
-uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType )
-{
-    return OWeakAggObject::queryInterface( rType );
-}
-
-
 void SAL_CALL GraphicDescriptor::acquire()
     noexcept
 {
-    OWeakAggObject::acquire();
+    OWeakObject::acquire();
 }
 
 
 void SAL_CALL GraphicDescriptor::release()
     noexcept
 {
-    OWeakAggObject::release();
+    OWeakObject::release();
 }
 
 

Reply via email to