Fix crash clicking the bottom of the combobox

Bug report: https://community.aseprite.org/t/9254
This commit is contained in:
David Capello 2021-05-28 15:44:27 -03:00
parent 3881589301
commit f5b452ae94

View File

@ -384,11 +384,17 @@ bool ComboBox::onProcessMessage(Message* msg)
return false;
}
else {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
// Use the nativeWindow() from the mouseMsg before we close
// the listbox because the mouseMsg->display() could be from
// the same popup.
const gfx::Point screenPos =
mouseMsg->display()->nativeWindow()->pointToScreen(mouseMsg->position());
closeListBox();
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
Widget* pick = manager()->pickFromScreenPos(
mouseMsg->display()->nativeWindow()->pointToScreen(mouseMsg->position()));
Widget* pick = manager()->pickFromScreenPos(screenPos);
if (pick && pick->hasAncestor(this))
return true;
}