mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-29 18:20:44 +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
|
// Save current state of all children when we start selecting
|
||||||
if (msg == nullptr ||
|
if (msg == nullptr ||
|
||||||
msg->type() == kMouseDownMessage ||
|
msg->type() == kMouseDownMessage ||
|
||||||
|
(msg->type() == kMouseMoveMessage && m_firstSelectedIndex < 0) ||
|
||||||
msg->type() == kKeyDownMessage) {
|
msg->type() == kKeyDownMessage) {
|
||||||
m_firstSelectedIndex = itemIndex;
|
m_firstSelectedIndex = itemIndex;
|
||||||
m_states.resize(children().size());
|
m_states.resize(children().size());
|
||||||
@ -256,8 +257,11 @@ bool ListBox::onProcessMessage(Message* msg)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case kMouseUpMessage:
|
case kMouseUpMessage:
|
||||||
if (hasCapture())
|
if (hasCapture()) {
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
|
m_firstSelectedIndex = -1;
|
||||||
|
m_lastSelectedIndex = -1;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case kMouseWheelMessage: {
|
case kMouseWheelMessage: {
|
||||||
|
Loading…
Reference in New Issue
Block a user