[PATCH] Fix deleting templates through Template Manager.

Rafael Dominguez (via Code Review) gerrit at gerrit.libreoffice.org
Tue Mar 26 22:35:24 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3076

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/76/3076/1

Fix deleting templates through Template Manager.

Change-Id: Ic59d3d666ae5f3808ef7dd7324589a731a841186
---
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 c537321..1cea676d 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1088,29 +1088,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/3076
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic59d3d666ae5f3808ef7dd7324589a731a841186
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Rafael Dominguez <venccsralph at gmail.com>



More information about the LibreOffice mailing list