1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix crash on closing game with open levelup dialog

This commit is contained in:
Ivan Savenko 2024-06-04 19:16:05 +00:00
parent b92f0c5619
commit 6c25552f84
2 changed files with 5 additions and 3 deletions

View File

@ -434,14 +434,15 @@ CLevelWindow::CLevelWindow(const CGHeroInstance * hero, PrimarySkill pskill, std
skillValue = std::make_shared<CLabel>(192, 253, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->primarySkillNames[static_cast<int>(pskill)] + " +1");
}
CLevelWindow::~CLevelWindow()
void CLevelWindow::close()
{
//FIXME: call callback if there was nothing to select?
if (box && box->selectedIndex() != -1)
cb(box->selectedIndex());
LOCPLINT->showingDialog->setFree();
CWindowObject::close();
}
CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj, const std::function<void()> & onWindowClosed)

View File

@ -150,7 +150,8 @@ class CLevelWindow : public CWindowObject
public:
CLevelWindow(const CGHeroInstance *hero, PrimarySkill pskill, std::vector<SecondarySkill> &skills, std::function<void(ui32)> callback);
~CLevelWindow();
void close() override;
};
/// Town portal, castle gate window