[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jan 26 06:48:21 PST 2016


 vcl/source/window/winproc.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 53e693ccfb19aa653ab2b5762c10ae87c9320954
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 26 14:46:49 2016 +0000

    Resolves: tdf#97331 use VclPtr instead of pointers to avoid crash
    
    Change-Id: Ia653a67046cb2cfb7c96367a7483ddc0cb29819e
    (cherry picked from commit 5d29ed1801a07d4649e095c25935b50f5ad32eb4)

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ef4cb76..66e89448 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1343,7 +1343,7 @@ static bool ImplCallWheelCommand( vcl::Window* pWindow, const Point& rPos,
 
 static bool acceptableWheelScrollTarget(const vcl::Window *pMouseWindow)
 {
-    return (pMouseWindow && pMouseWindow->IsInputEnabled() && !pMouseWindow->IsInModalMode());
+    return (pMouseWindow && !pMouseWindow->isDisposed() && pMouseWindow->IsInputEnabled() && !pMouseWindow->IsInModalMode());
 }
 
 //If the last event at the same absolute screen position was handled by a
@@ -1509,26 +1509,26 @@ public:
 bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt)
 {
     static SalWheelMouseEvent aPreviousEvent;
-    static vcl::Window *pPreviousWindow;
+    static VclPtr<vcl::Window> xPreviousWindow;
 
     if (!Setup())
         return false;
 
-    vcl::Window *pMouseWindow = FindTarget();
+    VclPtr<vcl::Window> xMouseWindow = FindTarget();
 
     // avoid the problem that scrolling via wheel to this point brings a widget
     // under the mouse that also accepts wheel commands, so stick with the old
     // widget if the time gap is very small
-    if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(pPreviousWindow))
+    if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(xPreviousWindow))
     {
-        pMouseWindow = pPreviousWindow;
+        xMouseWindow = xPreviousWindow.get();
     }
 
     aPreviousEvent = rEvt;
 
-    pPreviousWindow = Dispatch(pMouseWindow);
+    xPreviousWindow = Dispatch(xMouseWindow);
 
-    return pPreviousWindow != nullptr;
+    return xPreviousWindow;
 }
 
 class HandleGestureEvent : public HandleGestureEventBase


More information about the Libreoffice-commits mailing list