From: Vadim Zeitlin Date: Sat, 8 Nov 2008 00:06:34 +0000 (+0000) Subject: release the mouse in wxGrid dtor to avoid asserts when the grid is destroyed during... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e882d28829c9c4a9447bb40a08dd22942fbc3d27 release the mouse in wxGrid dtor to avoid asserts when the grid is destroyed during e.g. a cell selection operation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a5978ae75d..491b2c21bd 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4520,6 +4520,9 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id, wxGrid::~wxGrid() { + if ( m_winCapture ) + m_winCapture->ReleaseMouse(); + // Ensure that the editor control is destroyed before the grid is, // otherwise we crash later when the editor tries to do something with the // half destroyed grid @@ -6168,8 +6171,7 @@ void wxGrid::ChangeCursorMode(CursorMode mode, if ( m_winCapture ) { - if (m_winCapture->HasCapture()) - m_winCapture->ReleaseMouse(); + m_winCapture->ReleaseMouse(); m_winCapture = NULL; } @@ -6396,8 +6398,7 @@ wxGrid::DoGridCellLeftUp(wxMouseEvent& event, const wxGridCellCoords& coords) { if (m_winCapture) { - if (m_winCapture->HasCapture()) - m_winCapture->ReleaseMouse(); + m_winCapture->ReleaseMouse(); m_winCapture = NULL; }