vcl/source/app/salvtables.cxx |   10 ++++++----
 vcl/source/window/mouse.cxx   |    4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 6947cbca81b57adf78c0a3cf3108e664220d0cec
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Oct 5 12:35:05 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Oct 5 15:17:31 2023 +0200

    cool#7254 crash on double click of value set item in bullets and numbering
    
     #0  0x00007f6d6f39e7a8 in vcl::Window::MouseButtonUp 
(this=this@entry=0x34177ef0, rMEvt=...) at 
libreoffice/vcl/source/window/mouse.cxx:430
     #1  0x00007f6d6f6e6a32 in VclDrawingArea::MouseButtonUp (rMEvt=..., 
this=0x34177ef0) at libreoffice/include/vcl/layout.hxx:707
     #2  SalInstanceDrawingArea::dblclick (this=0x31351fd0, rPos=...) at 
libreoffice/vcl/source/app/salvtables.cxx:6288
     #3  0x00007f6d6f8c989c in LOKTrigger::trigger_dblclick (rPos=..., 
rDrawingArea=warning: can't find linker symbol for virtual table for 
`weld::DrawingArea' value
     warning:   found `construction vtable for 
SalInstanceDrawingArea-in-JSDrawingArea' instead
     ...) at libreoffice/include/vcl/jsdialog/executor.hxx:66
     #4  jsdialog::ExecuteAction (nWindowId=..., rWidget=..., rData=...) at 
libreoffice/vcl/jsdialog/executor.cxx:239
     #5  0x00007f6d6e46cebe in lcl_sendDialogEvent (nWindowId=<optimized out>, 
pArguments=<optimized out>)
         at libreoffice/desktop/source/lib/init.cxx:4961
     #6  0x000000000051eeee in lok::Document::sendDialogEvent 
(pArguments=<optimized out>, nWindowId=<optimized out>, this=0x30a67ca0)
         at libreoffice/include/LibreOfficeKit/LibreOfficeKit.hxx:323
     #7  ChildSession::dialogEvent (this=this@entry=0x32d5e410, tokens=...) at 
kit/ChildSession.cpp:1640
     #8  0x0000000000540465 in ChildSession::_handleInput (this=<optimized 
out>, buffer=<optimized out>, length=<optimized out>) at 
kit/ChildSession.cpp:257
    
    Change-Id: I655beb2a33cdb5d266db3bb50d8dc857192e5a4c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157592
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 1ace1412ffdc..ce78cf1e235c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6316,15 +6316,17 @@ OutputDevice& SalInstanceDrawingArea::get_ref_device() 
{ return *m_xDrawingArea-
 void SalInstanceDrawingArea::click(const Point& rPos)
 {
     MouseEvent aEvent(rPos, 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
-    m_xDrawingArea->MouseButtonDown(aEvent);
-    m_xDrawingArea->MouseButtonUp(aEvent);
+    VclPtr<VclDrawingArea> xDrawingArea(m_xDrawingArea);
+    xDrawingArea->MouseButtonDown(aEvent);
+    xDrawingArea->MouseButtonUp(aEvent);
 }
 
 void SalInstanceDrawingArea::dblclick(const Point& rPos)
 {
     MouseEvent aEvent(rPos, 2, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
-    m_xDrawingArea->MouseButtonDown(aEvent);
-    m_xDrawingArea->MouseButtonUp(aEvent);
+    VclPtr<VclDrawingArea> xDrawingArea(m_xDrawingArea);
+    xDrawingArea->MouseButtonDown(aEvent);
+    xDrawingArea->MouseButtonUp(aEvent);
 }
 
 void SalInstanceDrawingArea::mouse_up(const Point& rPos)
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 263c4e56fbc9..e5c8e130f74e 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -420,14 +420,14 @@ void Window::MouseMove( const MouseEvent& rMEvt )
 void Window::MouseButtonDown( const MouseEvent& rMEvt )
 {
     NotifyEvent aNEvt( NotifyEventType::MOUSEBUTTONDOWN, this, &rMEvt );
-    if (!EventNotify(aNEvt))
+    if (!EventNotify(aNEvt) && mpWindowImpl)
         mpWindowImpl->mbMouseButtonDown = true;
 }
 
 void Window::MouseButtonUp( const MouseEvent& rMEvt )
 {
     NotifyEvent aNEvt( NotifyEventType::MOUSEBUTTONUP, this, &rMEvt );
-    if (!EventNotify(aNEvt))
+    if (!EventNotify(aNEvt) && mpWindowImpl)
         mpWindowImpl->mbMouseButtonUp = true;
 }
 

Reply via email to