[Libreoffice-commits] core.git: forms/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jan 26 10:24:37 UTC 2017


 forms/source/component/ImageControl.cxx |    9 +++------
 forms/source/component/ImageControl.hxx |    6 +++---
 2 files changed, 6 insertions(+), 9 deletions(-)

New commits:
commit b98811106b3c657b0147c8cb7988899e2ed6ba54
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jan 26 10:11:49 2017 +0200

    use rtl::Reference in OImageControlModel
    
    instead of storing both a raw pointer and an uno::Reference
    
    Change-Id: If0e1380815e93015249cc19bc66b40befbfab50e
    Reviewed-on: https://gerrit.libreoffice.org/33570
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 966bbb1..a519f9c 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -130,7 +130,6 @@ Sequence<Type> OImageControlModel::_getTypes()
 OImageControlModel::OImageControlModel(const Reference<XComponentContext>& _rxFactory)
     :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_SUN_CONTROL_IMAGECONTROL, false, false, false )
                     // use the old control name for compytibility reasons
-    ,m_pImageProducer( nullptr )
     ,m_bExternalGraphic( true )
     ,m_bReadOnly( false )
     ,m_sImageURL()
@@ -146,7 +145,6 @@ OImageControlModel::OImageControlModel(const Reference<XComponentContext>& _rxFa
 OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, const Reference< XComponentContext >& _rxFactory )
     :OBoundControlModel( _pOriginal, _rxFactory )
                 // use the old control name for compytibility reasons
-    ,m_pImageProducer( nullptr )
     ,m_bExternalGraphic( true )
     ,m_bReadOnly( _pOriginal->m_bReadOnly )
     ,m_sImageURL( _pOriginal->m_sImageURL )
@@ -166,9 +164,8 @@ OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, co
 
 void OImageControlModel::implConstruct()
 {
-    m_pImageProducer = new ImageProducer;
-    m_xImageProducer = m_pImageProducer;
-    m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
+    m_xImageProducer = new ImageProducer;
+    m_xImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
 }
 
 
@@ -615,7 +612,7 @@ void OImageControlModel::doSetControlValue( const Any& _rValue )
     if ( bStartProduction )
     {
         // start production
-        Reference< XImageProducer > xProducer = m_xImageProducer;
+        rtl::Reference< ImageProducer > xProducer = m_xImageProducer;
         {
             // release our mutex once (it's acquired in the calling method!), as starting the image production may
             // result in the locking of the solar mutex (unfortunately the default implementation of our aggregate,
diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx
index 0a8da10..596cdb2 100644
--- a/forms/source/component/ImageControl.hxx
+++ b/forms/source/component/ImageControl.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/graphic/XGraphicObject.hpp>
 #include <comphelper/propmultiplex.hxx>
 #include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
 
 using namespace comphelper;
 
@@ -46,8 +47,7 @@ class OImageControlModel
                 :public OImageControlModel_Base
                 ,public OBoundControlModel
 {
-    css::uno::Reference< css::awt::XImageProducer>    m_xImageProducer;
-    ImageProducer*                                    m_pImageProducer;
+    rtl::Reference<ImageProducer>                     m_xImageProducer;
     bool                                              m_bExternalGraphic;
     bool                                              m_bReadOnly;
     OUString                                          m_sImageURL;
@@ -59,7 +59,7 @@ protected:
     // UNO Anbindung
     virtual css::uno::Sequence< css::uno::Type> _getTypes() override;
 
-    inline ImageProducer* GetImageProducer() { return m_pImageProducer; }
+    inline ImageProducer* GetImageProducer() { return m_xImageProducer.get(); }
 
 public:
     DECLARE_DEFAULT_LEAF_XTOR( OImageControlModel );


More information about the Libreoffice-commits mailing list