diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-08-28 18:02:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-29 21:39:14 +0200 |
commit | 864f89e92e31c239afdea5d429e5f569b3894d1a (patch) | |
tree | 8e81ba0ff8ba16d8920834a22a2b46d629d2e7c7 | |
parent | c6df07f905cd9562132b06e44f90b0479b250f7a (diff) |
Related tdf#111892: use unique_ptr
Change-Id: I8de0704cae36805737033c38950ac45be13198da
Reviewed-on: https://gerrit.libreoffice.org/41650
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sd/source/ui/dlg/TemplateScanner.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/inc/TemplateScanner.hxx | 10 |
2 files changed, 4 insertions, 15 deletions
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index 106819e61512..eb7ccaace5c1 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -115,7 +115,6 @@ class TemplateScanner::FolderDescriptorList TemplateScanner::TemplateScanner() : meState(INITIALIZE_SCANNING), maFolderContent(), - maFolderList(), mpFolderDescriptors(new FolderDescriptorList), mxTemplateRoot(), mxFolderEnvironment(), @@ -195,7 +194,7 @@ TemplateScanner::State TemplateScanner::ScanEntry() || (sContentType == "Impress 2.0")) { OUString sLocalisedTitle = SfxDocumentTemplates::ConvertResourceString(sTitle); - mpTemplateEntries.push_back(new TemplateEntry(sLocalisedTitle, sTargetURL)); + mpTemplateEntries.push_back(o3tl::make_unique<TemplateEntry>(sLocalisedTitle, sTargetURL)); } } @@ -204,12 +203,6 @@ TemplateScanner::State TemplateScanner::ScanEntry() } else { - if (!mpTemplateEntries.empty()) - { - SolarMutexGuard aGuard; - maFolderList.push_back(mpTemplateEntries); - } - // Continue with scanning the next folder. eNextState = SCAN_FOLDER; } diff --git a/sd/source/ui/inc/TemplateScanner.hxx b/sd/source/ui/inc/TemplateScanner.hxx index abdc64c62313..29085c4d3788 100644 --- a/sd/source/ui/inc/TemplateScanner.hxx +++ b/sd/source/ui/inc/TemplateScanner.hxx @@ -24,6 +24,7 @@ #include "sddllapi.h" #include <ucbhelper/content.hxx> #include "com/sun/star/uno/Reference.hxx" +#include <o3tl/make_unique.hxx> #include <memory> #include <vector> @@ -93,7 +94,7 @@ public: <nullptr/> is returned either before the template scanning is started or after it has ended. */ - const TemplateEntry* GetLastAddedEntry() const { return mpTemplateEntries.empty()?nullptr:mpTemplateEntries.back();} + const TemplateEntry* GetLastAddedEntry() const { return mpTemplateEntries.empty()?nullptr:mpTemplateEntries.back().get();} private: /** The current state determines which step will be executed next by @@ -112,12 +113,7 @@ private: State meState; ::ucbhelper::Content maFolderContent; - ::std::vector<TemplateEntry*> mpTemplateEntries; - - /** The data structure that is to be filled with information about the - template files. - */ - std::vector< ::std::vector<TemplateEntry*> > maFolderList; + ::std::vector< std::unique_ptr<TemplateEntry> > mpTemplateEntries; /** The folders that are collected by GatherFolderList(). */ |