summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-01-26 14:46:49 +0000
committerEike Rathke <erack@redhat.com>2016-01-26 20:25:48 +0000
commit72c2f90a42dad97cf9bc1a20c15f9946348fe01b (patch)
tree97b4941012900fee618cf5f5777f6fa01533790a /vcl
parent436b1615b271bae46a43530c2dab3a80b4e46419 (diff)
Resolves: tdf#97331 use VclPtr instead of pointers to avoid crash
(cherry picked from commit 5d29ed1801a07d4649e095c25935b50f5ad32eb4) (cherry picked from commit 53e693ccfb19aa653ab2b5762c10ae87c9320954) Change-Id: Ia653a67046cb2cfb7c96367a7483ddc0cb29819e Reviewed-on: https://gerrit.libreoffice.org/21810 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/winproc.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 304753a02285..e708e18e82c2 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1354,7 +1354,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
@@ -1520,26 +1520,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 != NULL;
+ return xPreviousWindow;
}
class HandleGestureEvent : public HandleGestureEventBase