From f5b452ae94aeb8e66ff5dbd7bedc5ef1ccc5fc4a Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 28 May 2021 15:44:27 -0300 Subject: [PATCH] Fix crash clicking the bottom of the combobox Bug report: https://community.aseprite.org/t/9254 --- src/ui/combobox.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/combobox.cpp b/src/ui/combobox.cpp index 1ddb68bcc..e6b3d87dd 100644 --- a/src/ui/combobox.cpp +++ b/src/ui/combobox.cpp @@ -384,11 +384,17 @@ bool ComboBox::onProcessMessage(Message* msg) return false; } else { + MouseMessage* mouseMsg = static_cast(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(msg); - Widget* pick = manager()->pickFromScreenPos( - mouseMsg->display()->nativeWindow()->pointToScreen(mouseMsg->position())); + Widget* pick = manager()->pickFromScreenPos(screenPos); if (pick && pick->hasAncestor(this)) return true; }