Fix crash double clicking a Dialog:canvas()

There were missing some setRecipient() when some messages are
converted to other kind of message (e.g. DoubleClick -> MouseDown)
This commit is contained in:
David Capello 2022-12-15 19:29:28 -03:00
parent 789e857d98
commit d4cefb8ba6
4 changed files with 7 additions and 0 deletions

View File

@ -927,6 +927,10 @@ int Dialog_canvas(lua_State* L)
auto mouseCallback =
[](lua_State* L, ui::MouseMessage* msg) {
ASSERT(msg->recipient());
if (!msg->recipient())
return;
lua_pushinteger(L, msg->position().x - msg->recipient()->bounds().x);
lua_setfield(L, -2, "x");

View File

@ -538,6 +538,7 @@ bool ComboBoxEntry::onProcessMessage(Message* msg)
kMouseDownMessage,
*mouseMsg,
mouseMsg->positionForDisplay(pick->display()));
mouseMsg2.setRecipient(pick);
mouseMsg2.setDisplay(pick->display());
pick->sendMessage(&mouseMsg2);
return true;

View File

@ -98,6 +98,7 @@ bool IntEntry::onProcessMessage(Message* msg)
MouseMessage mouseMsg2(kMouseDownMessage,
*mouseMsg,
mouseMsg->positionForDisplay(pick->display()));
mouseMsg2.setRecipient(pick);
mouseMsg2.setDisplay(pick->display());
pick->sendMessage(&mouseMsg2);
}

View File

@ -1557,6 +1557,7 @@ bool Widget::onProcessMessage(Message* msg)
MouseMessage mouseMsg2(kMouseDownMessage,
*mouseMsg,
mouseMsg->position());
mouseMsg2.setRecipient(this);
mouseMsg2.setDisplay(mouseMsg->display());
sendMessage(&mouseMsg2);
break;