mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-28 06:21:25 +00:00
Fix failing ASSERT(i >= 0 && i < int(m_states.size())) in ListBox::selectChild()
We receive kMouseMoveMessage as the first message of a multiselect message in a ListBox when the kMouseDownMessage message is received by a separator first e.g. if we click a separator from the Recover Files tab and start dragging the mouse this assert was failing.
This commit is contained in:
parent
79745756ef
commit
f0e80f1b5a
@ -81,6 +81,7 @@ void ListBox::selectChild(Widget* item, Message* msg)
|
||||
// Save current state of all children when we start selecting
|
||||
if (msg == nullptr ||
|
||||
msg->type() == kMouseDownMessage ||
|
||||
(msg->type() == kMouseMoveMessage && m_firstSelectedIndex < 0) ||
|
||||
msg->type() == kKeyDownMessage) {
|
||||
m_firstSelectedIndex = itemIndex;
|
||||
m_states.resize(children().size());
|
||||
@ -256,8 +257,11 @@ bool ListBox::onProcessMessage(Message* msg)
|
||||
return true;
|
||||
|
||||
case kMouseUpMessage:
|
||||
if (hasCapture())
|
||||
if (hasCapture()) {
|
||||
releaseMouse();
|
||||
m_firstSelectedIndex = -1;
|
||||
m_lastSelectedIndex = -1;
|
||||
}
|
||||
return true;
|
||||
|
||||
case kMouseWheelMessage: {
|
||||
|
Loading…
Reference in New Issue
Block a user