[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sfx2/source

Michael Stahl mstahl at redhat.com
Fri Feb 7 03:56:27 PST 2014


 sfx2/source/doc/templatedlg.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 69c487642143f5c77885ab674aa2aaae039b5bb7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 6 17:56:54 2014 +0100

    fdo#74148: sfx2: fix crash when editing template
    
    SfxTemplateManagerDlg::OnTemplateEdit() accesses invalid iterator
    because during loadComponentFromURL() it happens that
    ThumnailView::LoseFocus() is called and maSelTemplates is cleared.
    
    Change-Id: I074a70e5ce8bc89a38b720ddd0325c69c1d2b9ff
    (cherry picked from commit c8e206fdaab7490fb6e62bc7ab475888236179c2)
    Reviewed-on: https://gerrit.libreoffice.org/7904
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index d61d6b5..ea35031 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1235,8 +1235,10 @@ void SfxTemplateManagerDlg::OnTemplateEdit ()
     aArgs[2].Value <<= UpdateDocMode::ACCORDING_TO_CONFIG;
 
     uno::Reference< XStorable > xStorable;
+    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates(
+            maSelTemplates); // Avoids invalid iterators from LoseFocus
     std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-    for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter)
+    for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
     {
         const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*pIter);
 


More information about the Libreoffice-commits mailing list