diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 12:39:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 13:06:47 +0200 |
commit | d3ff66999d924e832f8219c65ced0526f1a67f82 (patch) | |
tree | 199187dc02ed3280e9e0f58102681182fd975a67 /forms/source | |
parent | afb60a273f9ed9f1ff17f25f62ef9dd15a4a7c3a (diff) |
use rtl::Reference in OClickableImageBaseModel
instead of storing both a raw pointer and an uno::Reference
Change-Id: I92dc79edef9046acc137a878d35dde935bb17674
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/clickableimage.cxx | 11 | ||||
-rw-r--r-- | forms/source/component/clickableimage.hxx | 9 |
2 files changed, 7 insertions, 13 deletions
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 54f0963b79a4..9bedc978d383 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -448,7 +448,6 @@ namespace frm ,OPropertyChangeListener(m_aMutex) ,m_xGraphicObject() ,m_pMedium(nullptr) - ,m_pProducer( nullptr ) ,m_bDispatchUrlInternal(false) ,m_bDownloading(false) ,m_bProdStarted(false) @@ -463,7 +462,6 @@ namespace frm ,OPropertyChangeListener( m_aMutex ) ,m_xGraphicObject( _pOriginal->m_xGraphicObject ) ,m_pMedium( nullptr ) - ,m_pProducer( nullptr ) ,m_bDispatchUrlInternal(false) ,m_bDownloading( false ) ,m_bProdStarted( false ) @@ -493,12 +491,10 @@ namespace frm void OClickableImageBaseModel::implConstruct() { - m_pProducer = new ImageProducer; - m_pProducer->SetDoneHdl( LINK( this, OClickableImageBaseModel, OnImageImportDone ) ); + m_xProducer = new ImageProducer; + m_xProducer->SetDoneHdl( LINK( this, OClickableImageBaseModel, OnImageImportDone ) ); osl_atomic_increment( &m_refCount ); { - m_xProducer = m_pProducer; - if ( m_xAggregateSet.is() ) { OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet ); @@ -578,8 +574,7 @@ namespace frm m_pMedium = nullptr; } - m_xProducer = nullptr; - m_pProducer = nullptr; + m_xProducer.clear(); } diff --git a/forms/source/component/clickableimage.hxx b/forms/source/component/clickableimage.hxx index 3408b6abb1e9..5250f6bed786 100644 --- a/forms/source/component/clickableimage.hxx +++ b/forms/source/component/clickableimage.hxx @@ -64,11 +64,10 @@ namespace frm OUString m_sTargetFrame; // TargetFrame to open // ImageProducer stuff - css::uno::Reference< css::awt::XImageProducer> m_xProducer; // Store the image in a graphic object to make it accessible via graphic cache using graphic ID. css::uno::Reference< css::graphic::XGraphicObject > m_xGraphicObject; SfxMedium* m_pMedium; // Download medium - ImageProducer* m_pProducer; + rtl::Reference<ImageProducer> m_xProducer; bool m_bDispatchUrlInternal; // property: is not allowed to set : 1 bool m_bDownloading : 1; // Is a download in progress? bool m_bProdStarted : 1; @@ -79,7 +78,7 @@ namespace frm DECL_LINK( DownloadDoneLink, void*, void ); - inline ImageProducer* GetImageProducer() { return m_pProducer; } + inline ImageProducer* GetImageProducer() { return m_xProducer.get(); } void StartProduction(); void SetURL(const OUString& rURL); @@ -108,7 +107,7 @@ namespace frm virtual void SAL_CALL disposing() override; // css::form::XImageProducerSupplier - virtual css::uno::Reference< css::awt::XImageProducer> SAL_CALL getImageProducer() throw (css::uno::RuntimeException, std::exception) override { return m_xProducer; } + virtual css::uno::Reference< css::awt::XImageProducer> SAL_CALL getImageProducer() throw (css::uno::RuntimeException, std::exception) override { return m_xProducer.get(); } // OPropertySetHelper virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle ) const override; @@ -143,7 +142,7 @@ namespace frm public: struct GuardAccess { friend class ImageModelMethodGuard; private: GuardAccess() { } }; ::osl::Mutex& getMutex( GuardAccess ) { return m_aMutex; } - ImageProducer* getImageProducer( GuardAccess ) { return m_pProducer; } + ImageProducer* getImageProducer( GuardAccess ) { return m_xProducer.get(); } protected: using OControlModel::getMutex; |