diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index e176ac862de9..8664e2b673a8 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -61,7 +61,7 @@ private: css::uno::Reference mxContent; ScDocShell* pDocShell; ScAddress aCellPos; - ScEditSource* mpEditSource; + std::unique_ptr mpEditSource; /// List of refresh listeners. comphelper::OInterfaceContainerHelper2* mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 4b33ea74f000..0316b832cc75 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -278,7 +278,7 @@ ScCellFieldsObj::ScCellFieldsObj( { pDocShell->GetDocument().AddUnoObject(*this); - mpEditSource = new ScCellEditSource( pDocShell, aCellPos ); + mpEditSource.reset( new ScCellEditSource( pDocShell, aCellPos ) ); } ScCellFieldsObj::~ScCellFieldsObj() @@ -288,7 +288,7 @@ ScCellFieldsObj::~ScCellFieldsObj() if (pDocShell) pDocShell->GetDocument().RemoveUnoObject(*this); - delete mpEditSource; + mpEditSource.reset(); // increment refcount to prevent double call off dtor osl_atomic_increment( &m_refCount );