mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-03 02:37:39 +00:00
Fix majors memory leaks (TODO: shared_ptr for Game objects and implement ~Game())
This commit is contained in:
parent
8f1e8fa106
commit
a8c59c41bc
12 changed files with 40 additions and 4 deletions
|
@ -30,7 +30,7 @@ EngineTab::EngineTab(wxWindow *parent, uciadapter::UCI *engine,
|
|||
}
|
||||
|
||||
EngineTab::EngineTab(wxWindow *parent, std::string name)
|
||||
: TabEngine(parent), TabInfos(TabInfos::ENGINE) {
|
||||
: TabEngine(parent), TabInfos(TabInfos::ENGINE), engine(NULL) {
|
||||
SetLabel(name);
|
||||
engineName = name;
|
||||
confGroup = "engines/" + engineName;
|
||||
|
@ -44,6 +44,14 @@ EngineTab::EngineTab(wxWindow *parent, std::string name)
|
|||
Bind(wxEVT_BUTTON, &EngineTab::OnDelete, this, ENGINE_DELETE_CONF_BUTTON);
|
||||
}
|
||||
|
||||
EngineTab::~EngineTab() {
|
||||
if (engine != NULL) {
|
||||
wxLogDebug("EngineTab destructor: destroying engine!");
|
||||
engine->quit();
|
||||
delete engine;
|
||||
}
|
||||
}
|
||||
|
||||
void EngineTab::OnDelete(wxCommandEvent &event) {
|
||||
CONFIG_OPEN(conf);
|
||||
conf->DeleteGroup(confGroup);
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
EngineTab(wxWindow *parent, uciadapter::UCI *engine,
|
||||
std::string engine_path_or_name);
|
||||
EngineTab(wxWindow *parent, std::string name);
|
||||
~EngineTab();
|
||||
void ApplyPreferences() {}
|
||||
void *GetGame() { return (NULL); }
|
||||
void *GetBase() { return (NULL); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue