[gnome-2048/arnaudb/wip/gtk4: 54/57] Clean old game.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 54/57] Clean old game.
- Date: Mon, 28 Sep 2020 14:35:55 +0000 (UTC)
commit b3e3892731b1040c28b6d23e7b76287611381590
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 a530ab8..c7d4503 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]