aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 7078076..a9e720d 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -52,7 +52,7 @@ MainWindow::MainWindow()
Bind(REFRESH_ENGINE_LIST, &MainWindow::OnRefreshEngineList, this, wxID_ANY);
// Add new game tab by default
- NewGame(new Game());
+ NewGame(std::shared_ptr<Game>(new Game()));
}
void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
@@ -191,8 +191,9 @@ void MainWindow::NewGame(bool useFen) {
}
void MainWindow::OnNewGame(wxCommandEvent &event) {
- Game *g = (Game *)event.GetClientData();
- NewGame(g);
+ std::shared_ptr<Game> *g = (std::shared_ptr<Game>*)event.GetClientData();
+ NewGame(*g);
+ delete g;
}
void MainWindow::OnPageChange(wxAuiNotebookEvent &event) {
@@ -214,7 +215,7 @@ void MainWindow::OnRefreshTabTitle(wxCommandEvent &event) {
}
}
-void MainWindow::NewGame(Game *game) {
+void MainWindow::NewGame(std::shared_ptr<Game> game) {
GameTab *gt = new GameTab((wxFrame *)notebook, game);
notebook->AddPage(gt, gt->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(gt));