diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-05-13 14:57:39 +0300 |
---|---|---|
committer | Bosdonnat Cedric <cedric.bosdonnat@free.fr> | 2013-05-13 15:05:57 +0000 |
commit | f218110744cbb2ec79796d886042546e47334cca (patch) | |
tree | 0201593918d8849e3182285ec7db28d46d71a280 /editeng | |
parent | cd1034f87ae0c03d8107e2e1fd8f968c3f7075b3 (diff) |
Get rid of GlobalEditData::GetStdRefDevice()
This avoids a crash on exit in a dbgutil build on OS X.
The horrible bOwnerOfRefDev crack screams out for boost::shared_ptr, I think?
Change-Id: Icf3ae3c28da0583a44472f36312b07766734bf7b
Reviewed-on: https://gerrit.libreoffice.org/3886
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/eerdll.cxx | 11 | ||||
-rw-r--r-- | editeng/source/editeng/eerdll2.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 20 |
3 files changed, 11 insertions, 24 deletions
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index c6a008df7eb8..704573aaa1eb 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -79,7 +79,6 @@ EditDLL& EditDLL::Get() } GlobalEditData::GlobalEditData() - : m_aStdRefDevice(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(::comphelper::getProcessComponentContext(), ::com::sun::star::uno::UNO_QUERY_THROW)) { ppDefItems = NULL; } @@ -188,16 +187,6 @@ uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGues return xLanguageGuesser; } -OutputDevice* GlobalEditData::GetStdRefDevice() -{ - if ( !m_aStdRefDevice ) - { - m_aStdRefDevice.reset(new VirtualDevice); - m_aStdRefDevice->SetMapMode( MAP_TWIP ); - } - return m_aStdRefDevice.get(); -} - EditResId::EditResId( sal_uInt16 nId ): ResId( nId, *EE_DLL().GetResMgr() ) { diff --git a/editeng/source/editeng/eerdll2.hxx b/editeng/source/editeng/eerdll2.hxx index ae592c347cc0..2c53b961c7f5 100644 --- a/editeng/source/editeng/eerdll2.hxx +++ b/editeng/source/editeng/eerdll2.hxx @@ -23,7 +23,6 @@ #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> #include <editeng/forbiddencharacterstable.hxx> #include <rtl/ref.hxx> -#include <comphelper/scoped_disposing_ptr.hxx> class SfxPoolItem; @@ -32,7 +31,6 @@ class GlobalEditData private: ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > xLanguageGuesser; - comphelper::scoped_disposing_solar_mutex_reset_ptr<OutputDevice> m_aStdRefDevice; SfxPoolItem** ppDefItems; rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable; @@ -42,14 +40,12 @@ public: ~GlobalEditData(); SfxPoolItem** GetDefItems(); - OutputDevice* GetStdRefDevice(); rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable(); void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; } ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetLanguageGuesser(); }; - #endif //_EERDLL2_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index b46b23cf72ef..8bd73063b646 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -150,10 +150,8 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aOnlineSpellTimer.SetTimeout( 100 ); aOnlineSpellTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) ); - pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice(); - // Access data already from here on! - SetRefDevice( pRefDev ); + SetRefDevice( NULL ); InitDoc( sal_False ); bCallParaInsertedOrDeleted = true; @@ -190,11 +188,16 @@ void ImpEditEngine::SetRefDevice( OutputDevice* pRef ) if ( bOwnerOfRefDev ) delete pRefDev; - pRefDev = pRef; - bOwnerOfRefDev = false; - if ( !pRef ) - pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice(); + { + pRefDev = new VirtualDevice; + pRefDev->SetMapMode( MAP_TWIP ); + bOwnerOfRefDev = true; + } else + { + pRefDev = pRef; + bOwnerOfRefDev = false; + } nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); @@ -210,8 +213,7 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) if ( GetRefDevice()->GetMapMode() == rMapMode ) return; - // When RefDev == GlobalRefDev => create own! - if ( !bOwnerOfRefDev && ( pRefDev == EE_DLL().GetGlobalData()->GetStdRefDevice() ) ) + if ( !bOwnerOfRefDev ) { pRefDev = new VirtualDevice; pRefDev->SetMapMode( MAP_TWIP ); |