From 6ccc70a8a5cf3bcf9504f3a0b7dd30969e4d7ae0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 7 Jan 2019 13:24:37 +0200 Subject: use unique_ptr in desktop::IpcThread Change-Id: I7f67b4c9a157d7a1a5992174397c061b14c8a674 Reviewed-on: https://gerrit.libreoffice.org/65952 Tested-by: Jenkins Reviewed-by: Noel Grandin --- desktop/source/app/officeipcthread.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 08c0d4b83fa7..59450974e1b0 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -292,9 +292,9 @@ static void ImplPostForeignAppEvent( ApplicationEvent* pEvent ) Application::PostUserEvent( LINK( nullptr, ProcessEventsClass_Impl, CallEvent ), pEvent ); } -static void ImplPostProcessDocumentsEvent( ProcessDocumentsRequest* pEvent ) +static void ImplPostProcessDocumentsEvent( std::unique_ptr pEvent ) { - Application::PostUserEvent( LINK( nullptr, ProcessEventsClass_Impl, ProcessDocumentsEvent ), pEvent ); + Application::PostUserEvent( LINK( nullptr, ProcessEventsClass_Impl, ProcessDocumentsEvent ), pEvent.release() ); } oslSignalAction SalMainPipeExchangeSignal_impl(SAL_UNUSED_PARAMETER void* /*pData*/, oslSignalInfo* pInfo) @@ -976,8 +976,8 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { ImplPostForeignAppEvent( pAppEvent ); } - ProcessDocumentsRequest* pRequest = new ProcessDocumentsRequest( - aCmdLineArgs->getCwdUrl()); + std::unique_ptr pRequest(new ProcessDocumentsRequest( + aCmdLineArgs->getCwdUrl())); m_handler->cProcessed.reset(); pRequest->pcProcessed = &m_handler->cProcessed; m_handler->mbSuccess = false; @@ -1108,13 +1108,12 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::DRAW ); } - ImplPostProcessDocumentsEvent( pRequest ); + ImplPostProcessDocumentsEvent( std::move(pRequest) ); } else { // delete not used request again - delete pRequest; - pRequest = nullptr; + pRequest.reset(); } if (aCmdLineArgs->IsEmpty()) { -- cgit