[gnome-2048/arnaudb/wip/gtk4: 48/48] Clean old game.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 48/48] Clean old game.
- Date: Wed, 29 Jul 2020 15:38:30 +0000 (UTC)
commit da8fc6b0194c4c39b44ab523b410e534128db18d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jul 20 18:01:05 2020 +0200
Clean old game.
src/game-window.vala | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index 9f6b321..15bf396 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -29,6 +29,7 @@ private class GameWindow : ApplicationWindow
[GtkChild] private GameHeaderBar _header_bar;
[GtkChild] private AspectFrame _frame;
private Game _game;
+ private bool _game_init_done = false;
[GtkChild] private Button _unfullscreen_button;
[GtkChild] private Label _gameover_label;
@@ -50,6 +51,7 @@ private class GameWindow : ApplicationWindow
_install_ui_action_entries ();
_init_game ();
+ _game_init_done = true;
_init_window ();
_create_scores_dialog (); // the library forbids to delay the dialog creation
@@ -94,6 +96,12 @@ private class GameWindow : ApplicationWindow
GLib.Settings.sync ();
}
+ if (_game_init_done)
+ {
+ ((!) _game).unparent ();
+ ((!) _game).destroy ();
+ }
+
_game = new Game (ref _settings);
_game.notify ["score"].connect (_header_bar.set_score);
_game.finished.connect ((show_scores) => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]