Use unique_ptr for ImpEditEngine::pEmptyItemSet

Change-Id: I1d7757eafb52fc3cc7d7e1cb02cced0a6004a304
This commit is contained in:
Stephan Bergmann
2017-06-13 11:20:36 +02:00
parent d57c9d81aa
commit a109a9ef74
2 changed files with 2 additions and 4 deletions

View File

@@ -427,7 +427,7 @@ private:
svtools::ColorConfig maColorConfig;
mutable SvtCTLOptions* pCTLOptions;
SfxItemSet* pEmptyItemSet;
std::unique_ptr<SfxItemSet> pEmptyItemSet;
EditUndoManager* pUndoManager;
ESelection* pUndoMarkSelection;

View File

@@ -113,7 +113,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
pEditEngine = pEE;
pRefDev = nullptr;
pVirtDev = nullptr;
pEmptyItemSet = nullptr;
pActiveView = nullptr;
pSpellInfo = nullptr;
pConvInfo = nullptr;
@@ -194,7 +193,6 @@ ImpEditEngine::~ImpEditEngine()
SetUpdateMode( false );
Dispose();
delete pEmptyItemSet;
// it's only legal to delete the pUndoManager if it was created by
// ImpEditEngine; if it was set by SetUndoManager() it must be cleared
// before destroying the ImpEditEngine!
@@ -701,7 +699,7 @@ const SfxItemSet& ImpEditEngine::GetEmptyItemSet()
{
if ( !pEmptyItemSet )
{
pEmptyItemSet = new SfxItemSet( aEditDoc.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END );
pEmptyItemSet = o3tl::make_unique<SfxItemSet>( aEditDoc.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END );
for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++)
{
pEmptyItemSet->ClearItem( nWhich );