vcl/source/control/button.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 901e160d2ea863af71c180980a76a81ec03b6b65
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue May 13 15:51:10 2025 +0200
Commit:     David Gilbert <freedesk...@treblig.org>
CommitDate: Wed May 14 22:55:25 2025 +0200

    vcl: static_cast to Dialog* once
    
    Change-Id: I181823042d4e6a93f3f1e064c11ecb13bd2d6f45
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185268
    Reviewed-by: David Gilbert <freedesk...@treblig.org>
    Tested-by: Jenkins

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 522c83500520..07e211c198df 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1855,13 +1855,14 @@ void CancelButton::Click()
         {
             if ( pParent->IsDialog() )
             {
-                if ( static_cast<Dialog*>(pParent)->IsInExecute() )
-                    static_cast<Dialog*>(pParent)->EndDialog();
+                Dialog* pDialog = static_cast<Dialog*>(pParent);
+                if (pDialog->IsInExecute())
+                    pDialog->EndDialog();
                 // prevent recursive calls
-                else if ( !static_cast<Dialog*>(pParent)->IsInClose() )
+                else if (!pDialog->IsInClose())
                 {
                     if ( pParent->GetStyle() & WB_CLOSEABLE )
-                        static_cast<Dialog*>(pParent)->Close();
+                        pDialog->Close();
                 }
             }
             else

Reply via email to