include/vcl/outdev.hxx |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 48d36423d59def00ece6148dbf58aae12bfd1715
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Aug 19 06:46:53 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Aug 19 08:59:21 2025 +0200

    Use comphelper::ScopeGuard instead of an ad-hoc struct
    
    It occurred to me, that we already have something for that (thanks
    Tomaž); and that it has an advantage of being non-copyable.
    
    Change-Id: I4d5f5b61abe6e39f216d4f093e270d95cb0c6b82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189893
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4ec08b257bf2..ce8a5efc28c3 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -60,8 +60,8 @@
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 
 #include <unotools/fontdefs.hxx>
+#include <comphelper/scopeguard.hxx>
 #include <cppuhelper/weakref.hxx>
-#include <o3tl/deleter.hxx>
 
 #include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/uno/Reference.h>
@@ -1921,15 +1921,8 @@ protected:
 
 [[nodiscard]] inline auto OutputDevice::ScopedPush(vcl::PushFlags nFlags)
 {
-    struct OutputDeviceRestoreStateGuard
-    {
-        OutputDevice& m_rDev;
-        ~OutputDeviceRestoreStateGuard() { 
suppress_fun_call_w_exception(m_rDev.Pop()); }
-    };
-
     Push(nFlags);
-    // [-loplugin:redundantfcast]
-    return OutputDeviceRestoreStateGuard{ *this };
+    return comphelper::ScopeGuard([this]() { Pop(); });
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to