From e05e1b93bd6e0a63288bd5af4e1caf38018b5402 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Sep 2014 20:46:06 +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/trunk@77900 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 ca5616a2f0..0b09eceee9 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4437,6 +4437,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;