Hi,
I have submitted a patch for review:
    https://gerrit.libreoffice.org/3239
To pull it, you can do:
    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/39/3239/1
Fix deleting templates through Template Manager.
Change-Id: I79c16eb264d957b510a8bf8ee2009e1f55190a0b
---
M sfx2/source/doc/templatedlg.cxx
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 6951df3..75449d0 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1079,29 +1079,18 @@
     else
     {
         sal_uInt16 nRegionItemId = maView->getCurRegionItemId();
+        std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates;  
//Avoid invalid iterators
 
         std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-        for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();)
+        for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
         {
-            if (maView->removeTemplate((*pIter)->mnId,nRegionItemId))
-                maSelTemplates.erase(pIter++);
-            else
+            if (!maView->removeTemplate((*pIter)->mnId,nRegionItemId))
             {
                 if (aTemplateList.isEmpty())
                     aTemplateList = (*pIter)->maTitle;
                 else
                     aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle;
-
-                ++pIter;
             }
-        }
-
-        if (maSelTemplates.empty())
-        {
-            mpTemplateBar->SetItemDown(TBI_TEMPLATE_DELETE,false);
-            mpTemplateBar->Show(false);
-            mpViewBar->Show();
-            mpActionBar->Show();
         }
     }
 
-- 
To view, visit https://gerrit.libreoffice.org/3239
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79c16eb264d957b510a8bf8ee2009e1f55190a0b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Rafael Dominguez <venccsralph@gmail.com>
Context
- [PATCH libreoffice-4-0] Fix deleting templates through Template	Manager. · Rafael Dominguez (via Code Review)
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.