[Libreoffice-commits] core.git: sd/source

Michael Stahl mstahl at redhat.com
Thu May 4 20:20:41 UTC 2017


 sd/source/ui/presenter/CanvasUpdateRequester.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 670631cae260263e4822d8aa63bc5c2e4349c796
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 4 22:18:05 2017 +0200

    sd: oops, skipped one entry on every erase by incrementing
    
    Thanks Noel for the hint.
    
    Change-Id: I4992ce6d92ea185c7ab2f3ca452d3920204bb9f7

diff --git a/sd/source/ui/presenter/CanvasUpdateRequester.cxx b/sd/source/ui/presenter/CanvasUpdateRequester.cxx
index ee385533773f..456c37d43a58 100644
--- a/sd/source/ui/presenter/CanvasUpdateRequester.cxx
+++ b/sd/source/ui/presenter/CanvasUpdateRequester.cxx
@@ -44,10 +44,14 @@ std::shared_ptr<CanvasUpdateRequester> CanvasUpdateRequester::Instance (
     static std::vector<std::pair<
         uno::WeakReference<rendering::XSpriteCanvas>,
         std::weak_ptr<CanvasUpdateRequester>>> s_RequesterMap;
-    for (auto it = s_RequesterMap.begin(); it != s_RequesterMap.end(); ++it)
+    for (auto it = s_RequesterMap.begin(); it != s_RequesterMap.end(); )
     {
         uno::Reference<rendering::XSpriteCanvas> const xCanvas(it->first);
-        if (xCanvas == rxSharedCanvas)
+        if (!xCanvas.is())
+        {
+            it = s_RequesterMap.erase(it); // remove stale entry
+        }
+        else if (xCanvas == rxSharedCanvas)
         {
             std::shared_ptr<CanvasUpdateRequester> pRequester(it->second);
             if (pRequester)
@@ -64,10 +68,7 @@ std::shared_ptr<CanvasUpdateRequester> CanvasUpdateRequester::Instance (
         }
         else
         {
-            if (!xCanvas.is())
-            {
-                it = s_RequesterMap.erase(it); // remove stale entry
-            }
+            ++it;
         }
     }
 


More information about the Libreoffice-commits mailing list