diff options
author | Uray M. János <uray.janos@gmail.com> | 2012-09-02 16:21:08 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-09-07 11:20:48 +0200 |
commit | 81f72a3c3a30ef00dfb03bd7fab148d2fcf3e4f8 (patch) | |
tree | d5586410e1f0d6b7413f1cab952c76c1978e0a7f /basctl/source/basicide/basdoc.cxx | |
parent | 5764c51f2c9870c91727464c0d889d3554a5663e (diff) |
Cleanup in basctl (raw pointers)
Lots of raw pointers have been converted to boost::scoped_ptr to reduce
the number of 'delete's and the possibility of memory leaks.
Some pointers have been converted to references, to reduce the needless
checking for nullptrs, and so simplifying the code.
Also some #define-s have been converted to C++ constants or enumerations.
Change-Id: Ifbeb78f744bac7a96c8a446ff4db90dedf85fe26
Diffstat (limited to 'basctl/source/basicide/basdoc.cxx')
-rw-r--r-- | basctl/source/basicide/basdoc.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index 67f358c13599..6f64fbcf4af2 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -48,31 +48,27 @@ SFX_IMPL_INTERFACE( basctl_DocShell, SfxObjectShell, IDEResId( 0 ) ) DocShell::DocShell() :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) { - pPrinter = 0; SetPool( &SFX_APP()->GetPool() ); SetBaseModel( new SIDEModel(this) ); } DocShell::~DocShell() -{ - delete pPrinter; -} +{ } SfxPrinter* DocShell::GetPrinter( bool bCreate ) { if ( !pPrinter && bCreate ) - pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) ); + pPrinter.reset(new SfxPrinter(new SfxItemSet( + GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN + ))); - return pPrinter; + return pPrinter.get(); } void DocShell::SetPrinter( SfxPrinter* pPr ) { - if ( pPr != pPrinter ) - { - delete pPrinter; - pPrinter = pPr; - } + if (pPr != pPrinter.get()) + pPrinter.reset(pPr); } void DocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const |