comphelper/qa/unit/test_guards.cxx                       |   41 +++++++++++++--
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx |   12 ----
 2 files changed, 37 insertions(+), 16 deletions(-)

New commits:
commit f646107a55a3b6d3204b4456200d555848de51a2
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Aug 8 10:28:40 2025 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Aug 18 15:34:17 2025 +0200

    no need for a special function that changes back the flag
    
    Change-Id: I9c96006ffa9497005d538e6eb5fbae0c69878b68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189164
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx 
b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 2f38aa0399db..d7de86b3c72e 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -991,16 +991,6 @@ namespace sdr::contact {
         return *pDevice;
     }
 
-
-    namespace
-    {
-        void lcl_resetFlag( bool& rbFlag )
-        {
-            rbFlag = false;
-        }
-    }
-
-
     bool ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow( 
IPageViewAccess const & _rPageView, const OutputDevice& _rDevice,
         const basegfx::B2DHomMatrix& _rInitialViewTransformation )
     {
@@ -1020,7 +1010,7 @@ namespace sdr::contact {
         }
 
         m_bCreatingControl = true;
-        ::comphelper::ScopeGuard aGuard([&] () { 
lcl_resetFlag(m_bCreatingControl); });
+        ::comphelper::ScopeGuard aGuard([&] () { m_bCreatingControl = false; 
});
 
         if ( m_aControl.is() )
         {
commit aab65460f567fd42e92bdf1ec77b181e7a80eb0b
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Aug 17 12:07:27 2025 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Aug 18 15:34:06 2025 +0200

    comphelper: Update FlagRestorationGuard test with additional cases
    
    So we test all possibilities.
    
    Change-Id: If2f4712b0bac41d11d845c21a3917ed3fb0b41d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189816
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins

diff --git a/comphelper/qa/unit/test_guards.cxx 
b/comphelper/qa/unit/test_guards.cxx
index 83034a2dcc6a..48a1f2cd0992 100644
--- a/comphelper/qa/unit/test_guards.cxx
+++ b/comphelper/qa/unit/test_guards.cxx
@@ -50,15 +50,46 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, 
testFlagRestorationGuard)
 {
     // Test that comphelper::FlagRestorationGuard properly sets and resets the 
flag
 
-    // initial value "true", change to "false", out-of-scope change to "true"
+    {
+        // initial value "true", change to "false", out-of-scope change to 
"true"
+        bool bFlag = true;
+        {
+            comphelper::FlagRestorationGuard aGuard(bFlag, false);
+            CPPUNIT_ASSERT(!bFlag);
+        }
+        // comphelper::FlagRestorationGuard must reset flag to initial state 
on destruction
+        CPPUNIT_ASSERT(bFlag);
+    }
+
+    {
+        // initial value "false", change to "true", out-of-scope change to 
"false"
+        bool bFlag = false;
+        {
+            comphelper::FlagRestorationGuard aGuard(bFlag, true);
+            CPPUNIT_ASSERT(bFlag);
+        }
+        CPPUNIT_ASSERT(!bFlag);
+    }
 
-    bool bFlag = true;
     {
-        comphelper::FlagRestorationGuard aGuard(bFlag, false);
+        // initial value "false", change to "false", out-of-scope change to 
"false"
+        bool bFlag = false;
+        {
+            comphelper::FlagRestorationGuard aGuard(bFlag, false);
+            CPPUNIT_ASSERT(!bFlag);
+        }
         CPPUNIT_ASSERT(!bFlag);
     }
-    // comphelper::FlagRestorationGuard must reset flag to initial state on 
destruction
-    CPPUNIT_ASSERT(bFlag);
+
+    {
+        // initial value "true", change to "true", out-of-scope change to 
"true"
+        bool bFlag = true;
+        {
+            comphelper::FlagRestorationGuard aGuard(bFlag, true);
+            CPPUNIT_ASSERT(bFlag);
+        }
+        CPPUNIT_ASSERT(bFlag);
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testValueRestorationGuard)

Reply via email to