Kaydet (Commit) 576c7562 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Return std::unique_ptr from svt::AcceleratorExecute::createAcceleratorHelper

...to prevent errors like 5ac6e002 "Memory leak"

Change-Id: I3e20393af628849d8a387b491b75e1aacdea982a
üst 1e0e115d
......@@ -1252,7 +1252,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
// handle accelerators
if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() )
{
m_apAccelExecute.reset( ::svt::AcceleratorExecute::createAcceleratorHelper());
m_apAccelExecute = ::svt::AcceleratorExecute::createAcceleratorHelper();
OSL_ASSERT( m_apAccelExecute.get());
if( m_apAccelExecute.get() )
m_apAccelExecute->init( m_xCC, m_xFrame );
......
......@@ -47,7 +47,7 @@ namespace dbaui
,m_xController( &_rController )
,m_aSeparator( VclPtr<FixedLine>::Create(this) )
{
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
m_pAccel = ::svt::AcceleratorExecute::createAcceleratorHelper();
m_aSeparator->Show();
}
......
......@@ -22,6 +22,7 @@
#include <svtools/svtdllapi.h>
#include <memory>
#include <vector>
#include <com/sun/star/uno/XComponentContext.hpp>
......@@ -114,7 +115,7 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
environment will be recognized ... The helper stop its
work immediately then!
*/
static AcceleratorExecute* createAcceleratorHelper();
static std::unique_ptr<AcceleratorExecute> createAcceleratorHelper();
/** @short fight against inlining ... */
......
......@@ -442,7 +442,7 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
// try the 'normal' accelerators (so that eg. Ctrl+Q works)
if (!mpAccExec)
{
mpAccExec.reset(svt::AcceleratorExecute::createAcceleratorHelper());
mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame);
}
......
......@@ -1619,8 +1619,7 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
{
if (!pImp->m_xAccExec.get())
{
pImp->m_xAccExec.reset(
::svt::AcceleratorExecute::createAcceleratorHelper() );
pImp->m_xAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper();
pImp->m_xAccExec->init(::comphelper::getProcessComponentContext(),
pFrame->GetFrame().GetFrameInterface());
}
......
......@@ -93,10 +93,9 @@ AcceleratorExecute::~AcceleratorExecute()
}
AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper()
std::unique_ptr<AcceleratorExecute> AcceleratorExecute::createAcceleratorHelper()
{
AcceleratorExecute* pNew = new AcceleratorExecute();
return pNew;
return std::unique_ptr<AcceleratorExecute>(new AcceleratorExecute);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment