[PATCH libreoffice-4-0] Fix deleting templates through Template Manager.

Rafael Dominguez (via Code Review) gerrit at gerrit.libreoffice.org
Sun Apr 7 11:51:44 PDT 2013


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 at gmail.com>



More information about the LibreOffice mailing list