fixed crash in wxSpinButton (patch 646214)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21812 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-09 21:38:05 +00:00
parent cda66071f1
commit f9bd9677e8

View File

@@ -170,7 +170,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const
arrow = m_control->HitTest(event.GetPosition()); arrow = m_control->HitTest(event.GetPosition());
} }
if ( m_captureData ) if ( m_captureData && m_captureData->m_timerScroll)
{ {
// the mouse is captured, we may want to pause scrolling if it goes // the mouse is captured, we may want to pause scrolling if it goes
// outside the arrow or to resume it if we had paused it before // outside the arrow or to resume it if we had paused it before
@@ -247,10 +247,22 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const
m_captureData->m_window->CaptureMouse(); m_captureData->m_window->CaptureMouse();
// start scrolling // start scrolling
m_captureData->m_timerScroll = wxScrollArrowTimer *tmpTimerScroll =
new wxScrollArrowTimer(m_control, arrow); new wxScrollArrowTimer(m_control, arrow);
m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE); // Because in some cases wxScrollArrowTimer can cause
// m_captureData to be destructed we need to test if it
// is still valid before using.
if (m_captureData)
{
m_captureData->m_timerScroll = tmpTimerScroll;
m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE);
}
else
{
delete tmpTimerScroll;
}
} }
//else: mouse already captured, nothing to do //else: mouse already captured, nothing to do
} }