vcl/source/window/paint.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 79f6c934f5b27158b8e7204bc25023fb14463c9d
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Nov 18 08:47:15 2025 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Nov 18 10:34:34 2025 +0100

    vcl: fix crash in Window::ImplInvalidate()
    
    Crashreport:
    
            #0  0x00007377176d3ff5 in vcl::Window::ImplInvalidate 
(this=0x33912050, pRegion=0x0, nFlags=InvalidateFlags::NONE)
                at 
/home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/vcl/source/window/paint.cxx:787
            #1  0x00007377176d0cb5 in vcl::Window::Invalidate (this=0x33912050, 
nFlags=InvalidateFlags::NONE)
                at 
/home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/vcl/source/window/paint.cxx:1148
            #2  0x00007377177e0d26 in Edit::ImplInvalidateOrRepaint 
(this=<optimized out>) at 
/home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/vcl/source/control/edit.cxx:450
            #3  0x00007377177e47c0 in Edit::ImplAlignAndPaint (this=0x33912050) 
at 
/home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/vcl/source/control/edit.cxx:1166
            #4  Edit::ImplInsertText (this=0x33912050, rStr=..., 
pNewSel=0x7ffe6111c510, bIsUserInput=<optimized out>)
                at 
/home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/vcl/source/control/edit.cxx:881
    
    gdb on the coredump says mpWindowImpl in vcl::Window::ImplInvalidate()
    was nullptr.
    
    Change-Id: I06f99b5ede457c4487e97e8259890b29e54804d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194112
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>
    (cherry picked from commit e66599cc396a79e4fc0f59ee256148bc00ca6e15)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194154
    Tested-by: Andras Timar <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index d4ba048bf49d..66ef06148eed 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1145,6 +1145,12 @@ void Window::Invalidate( InvalidateFlags nFlags )
     if ( !comphelper::LibreOfficeKit::isActive() && 
(!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || 
!GetOutDev()->mnOutHeight) )
         return;
 
+    if (!mpWindowImpl)
+    {
+        // ImplInvalidate() would dereference mpWindowImpl unconditionally.
+        return;
+    }
+
     ImplInvalidate( nullptr, nFlags );
     LogicInvalidate(nullptr);
 }

Reply via email to