1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-29 21:56:54 +02:00

Fixed two memory leaks

This commit is contained in:
AlexVinS 2018-11-14 20:58:37 +03:00
parent 8e34b1b9a8
commit 614cde4a55
2 changed files with 9 additions and 4 deletions

View File

@ -1124,8 +1124,11 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
exit->assignedKeys.insert(SDLK_ESCAPE);
exit->setImageOrder(4, 5, 6, 7);
auto split = std::make_shared<CButton>(Point(744, 382), "TSBTNS", CButton::tooltip(CGI->generaltexth->tcommands[3]), [&](){garr->splitClick();});
split->addCallback(std::bind(&HeroSlots::splitClicked, heroes));
auto split = std::make_shared<CButton>(Point(744, 382), "TSBTNS", CButton::tooltip(CGI->generaltexth->tcommands[3]), [&]()
{
garr->splitClick();
heroes->splitClicked();
});
garr->addSplitBtn(split);
Rect barRect(9, 182, 732, 18);

View File

@ -923,9 +923,11 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
statusbar = CGStatusBar::create(std::make_shared<CPicture>(*background, barRect, 5, 578, false));
//garrison interface
garr = std::make_shared<CGarrisonInt>(69, 131, 4, Point(418,0), heroInst[0], heroInst[1], true, true);
garr->addSplitBtn(std::make_shared<CButton>( Point( 10, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), std::bind(&CGarrisonInt::splitClick, garr)));
garr->addSplitBtn(std::make_shared<CButton>( Point(740, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), std::bind(&CGarrisonInt::splitClick, garr)));
auto splitButtonCallback = [&](){ garr->splitClick(); };
garr->addSplitBtn(std::make_shared<CButton>( Point( 10, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback));
garr->addSplitBtn(std::make_shared<CButton>( Point(740, 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback));
updateWidgets();
}