sw/source/core/inc/viewimp.hxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae1876f189a1f92aba6a3a40656f9f557b7df23f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon May 15 21:09:05 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue May 16 12:19:53 2023 +0200

    tdf#155349 std::move of a std::optional leave behind a set std::optional
    
    unlike std::move of a std::unique_ptr which leaves behind an empty
    std::unique_ptr
    
    so if HasPaintRegion was true before TakePaintRegion it was
    still true after TakePaintRegion
    
    Change-Id: I6569f5ccd8081cbcec42190c474a98c4e28030a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151774
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index f68c9c7f1f90..4b249154c2f8 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -152,7 +152,7 @@ public:
 
     bool AddPaintRect( const SwRect &rRect );
     bool HasPaintRegion()      { return m_oPaintRegion.has_value(); }
-    std::optional<SwRegionRects> TakePaintRegion() { return 
std::move(m_oPaintRegion); }
+    std::optional<SwRegionRects> TakePaintRegion() { auto ret = 
std::move(m_oPaintRegion); m_oPaintRegion.reset(); return ret; }
     const std::optional<SwRegionRects>& GetPaintRegion() { return 
m_oPaintRegion; }
     void DeletePaintRegion() { m_oPaintRegion.reset(); }
 

Reply via email to