Blob Blame History Raw
From 0410c35ff5f46e51def9a2515d8e5a72f8fd37c4 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 24 Nov 2015 15:20:22 +0100
Subject: [PATCH 361/398] sw lok comments: avoid crash an exit after clicking
 the scrollbar

Without this, vcl::Window::ImplTrackTimerHdl() will be called on a
deleted vcl::Window.

Can be reproduced with a comment having a scrollbar in a LOK client,
then clicking on the down button of the scrollbar a number of times ->
crash on exit.

Change-Id: I5d67f96e8baa199f65ec5cf39cb5d39c8162ff33
(cherry picked from commit 7c654ee9d51a752e02c0a972de27d699ab5b649a)
---
 sw/source/uibase/docvw/SidebarScrollBar.cxx | 5 +++++
 sw/source/uibase/docvw/SidebarScrollBar.hxx | 1 +
 2 files changed, 6 insertions(+)

diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index 7a80363693d1..b4d70b423eec 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
     rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
 }
 
+void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/)
+{
+    EndTracking();
+}
+
 void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
 {
     TrackingEvent aEvent(rMouseEvent);
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
index ea5639e42e92..0de225b2a135 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
@@ -31,6 +31,7 @@ protected:
     /// @see OutputDevice::LogicInvalidate().
     void LogicInvalidate(const Rectangle* pRectangle) override;
     void MouseMove(const MouseEvent& rMouseEvent) override;
+    void MouseButtonUp(const MouseEvent& rMouseEvent) override;
 public:
     SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
     virtual ~SidebarScrollBar();
-- 
2.12.0