vcl/win/window/salframe.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit a086036723e0f358af2686ffc2a525627c4bb201
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Dec 18 15:08:50 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Dec 19 08:25:51 2025 +0100

    add asserts to WinSalFrame::ReleaseGraphics (tdf#169876 related)
    
    to make it possible to catch similar problems earlier
    
    Change-Id: Id129ea4fb74997d2414a05a257921721dd419cdb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195843
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ebbd3c468fed..f43fd00dc4a3 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1043,6 +1043,7 @@ SalGraphics* WinSalFrame::AcquireGraphics()
 
 void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
 {
+    assert(mbGraphicsAcquired && "Can only call ReleaseGraphics when you own 
the graphics");
     if ( mpThreadGraphics == pGraphics )
     {
         SalData* pSalData = GetSalData();
@@ -1052,6 +1053,10 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* 
pGraphics )
         pSalData->mpInstance->SendComWndMessage(SAL_MSG_RELEASEDC,
             reinterpret_cast<WPARAM>(mhWnd), reinterpret_cast<LPARAM>(hDC) );
     }
+    else
+    {
+        assert(mpLocalGraphics == pGraphics);
+    }
     mbGraphicsAcquired = false;
 }
 

Reply via email to