mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-03 10:47: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
|
@ -14,6 +14,11 @@ BoardCanvas::BoardCanvas(wxFrame *parent)
|
|||
ApplyPreferences();
|
||||
}
|
||||
|
||||
BoardCanvas::~BoardCanvas() {
|
||||
delete t;
|
||||
delete t_captures;
|
||||
}
|
||||
|
||||
BoardCanvas::BoardCanvas(wxFrame *parent, std::uint32_t square_width,
|
||||
bool frozen)
|
||||
: BoardCanvas(parent) {
|
||||
|
|
|
@ -54,6 +54,7 @@ class BoardCanvas : public wxPanel {
|
|||
public:
|
||||
BoardCanvas(wxFrame *parent);
|
||||
BoardCanvas(wxFrame *parent,std::uint32_t square_width, bool frozen);
|
||||
~BoardCanvas();
|
||||
void ApplyPreferences();
|
||||
void DrawBoard(wxPaintDC &dc);
|
||||
void OnPaint(wxPaintEvent &event);
|
||||
|
|
|
@ -13,6 +13,13 @@ LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
|
|||
Bind(wxEVT_CLOSE_WINDOW, &LiveEngineDialog::OnClose, this);
|
||||
}
|
||||
|
||||
LiveEngineDialog::~LiveEngineDialog() {
|
||||
if (engine != NULL) {
|
||||
wxLogDebug("LiveEngineDialog destructor: delete engine");
|
||||
delete engine;
|
||||
}
|
||||
}
|
||||
|
||||
void LiveEngineDialog::InitEngine() {
|
||||
if (engine == NULL) {
|
||||
wxLogDebug("Start engine: %s", engine_name);
|
||||
|
@ -51,9 +58,8 @@ void LiveEngineDialog::OnClose(wxCloseEvent &e) {
|
|||
timer.Stop();
|
||||
engine->stop();
|
||||
engine->quit();
|
||||
delete engine;
|
||||
}
|
||||
e.Skip();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void LiveEngineDialog::SetFEN(std::string fen) {
|
||||
|
|
|
@ -10,6 +10,7 @@ class LiveEngineDialog : public DialogLiveEngine {
|
|||
|
||||
public:
|
||||
LiveEngineDialog(wxWindow *parent, std::string engine_name);
|
||||
~LiveEngineDialog();
|
||||
void InitEngine();
|
||||
void TogglePauseEngine(wxCommandEvent &event);
|
||||
void OnTimerTick(wxTimerEvent &event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue