Permalink
Browse files

Fixed two memory leaks

  • Loading branch information...
alexvins committed Nov 14, 2018
1 parent 8e34b1b commit 614cde4a552415cd36d24a16419cf6180b900d49
Showing with 9 additions and 4 deletions.
  1. +5 −2 client/windows/CCastleInterface.cpp
  2. +4 −2 client/windows/GUIClasses.cpp
@@ -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);
@@ -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();
}

0 comments on commit 614cde4

Please sign in to comment.