From 2ddddc46fdc3cf18cefcca29934eaab0544d2198 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 Jul 2018 16:19:55 +0200 Subject: Make ThreadPool::pushTask take param by std::unique_ptr And fix leak in XclExpRowBuffer::Finalize, was not freeing the synchronous task it creates Change-Id: Id1e9ddb5d968e6b95d9d2b5ca0c9e50774580182 Reviewed-on: https://gerrit.libreoffice.org/56874 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/source/zipapi/ZipOutputStream.cxx | 4 ++-- package/source/zippackage/ZipPackageStream.cxx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'package/source') diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index f7f54d6ff421..94f8d024dd7c 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -68,9 +68,9 @@ void ZipOutputStream::setEntry( ZipEntry *pEntry ) } } -void ZipOutputStream::addDeflatingThread( ZipOutputEntry *pEntry, comphelper::ThreadTask *pThread ) +void ZipOutputStream::addDeflatingThread( ZipOutputEntry *pEntry, std::unique_ptr pThread ) { - comphelper::ThreadPool::getSharedOptimalPool().pushTask(pThread); + comphelper::ThreadPool::getSharedOptimalPool().pushTask(std::move(pThread)); m_aEntries.push_back(pEntry); } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 908a093cb62d..a558be575127 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -835,7 +836,7 @@ bool ZipPackageStream::saveChild( // Start a new thread deflating this zip entry ZipOutputEntry *pZipEntry = new ZipOutputEntry( m_xContext, *pTempEntry, this, bToBeEncrypted); - rZipOut.addDeflatingThread( pZipEntry, new DeflateThread(rZipOut.getThreadTaskTag(), pZipEntry, xStream) ); + rZipOut.addDeflatingThread( pZipEntry, o3tl::make_unique(rZipOut.getThreadTaskTag(), pZipEntry, xStream) ); } else { -- cgit