X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f313deaa38ebd9d8a9a2755a105e12999dd5493c..d485bda109d5ef0fef36a3f737549e9b9f54baab:/src/common/lboxcmn.cpp diff --git a/src/common/lboxcmn.cpp b/src/common/lboxcmn.cpp index ce0cbbb16e..0e1d050193 100644 --- a/src/common/lboxcmn.cpp +++ b/src/common/lboxcmn.cpp @@ -167,6 +167,14 @@ void wxListBoxBase::DeselectAll(int itemToLeaveSelected) void wxListBoxBase::UpdateOldSelections() { + // When the control becomes empty, any previously remembered selections are + // invalid anyhow, so just forget them. + if ( IsEmpty() ) + { + m_oldSelections.clear(); + return; + } + // We need to remember the selection even in single-selection case on // Windows, so that we don't send an event when the user clicks on an // already selected item.