Hey, i need to wrap an event handler into another one, but without success.
void ContextMenu::addItem(String name, String text, EventHandler* handler)
{
ButtonText* item = CreateChild<ButtonText>(name);
item->SetStyle("ActionItem");
item->SetFixedHeight(20);
item->setLabel(text);
//item->SetVar(VAR_ITEM_HANDLER, handler);
SubscribeToEvent(item, "Released", [&](StringHash, VariantMap& eventData)
{
handler->Invoke(eventData); // crash at this point !
close();
});
}
The function call :
contextMenu_->addItem("open", "Open file", URHO3D_HANDLER(LocalWorldEditorState, handleOpenFile));