From 0978bf14121e6b2ad88aab8c8eb6dd24d2e8863d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 Oct 2014 14:35:30 +0000 Subject: [PATCH] Avoid selecting all rows up to UINT_MAX in generic wxDataViewCtrl. Shift clicking in a control with multiple selections without a previous current row attempted to select all rows from the current one up to UINT_MAX which resulted in a program freezing (and probably running out of memory in 64 bit builds). Fix this by explicitly checking for the absence of the current item. Closes #16582. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 4e15c71aee..95ef21a99b 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4359,6 +4359,13 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) unsigned int lineFrom = oldCurrentRow, lineTo = current; + if ( lineFrom == static_cast(-1) ) + { + // If we hadn't had any current row before, treat this as a + // simple click and select the new row only. + lineFrom = current; + } + if ( lineTo < lineFrom ) { lineTo = lineFrom;