[gnome-mahjongg] Destroy "no moves left" dialog before using the result



commit 66544c4a738f16abc24dfc20996360b4f015b9e5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Aug 17 14:18:21 2014 -0500

    Destroy "no moves left" dialog before using the result
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732225

 src/gnome-mahjongg.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index 6e3d11e..5f16ce8 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -393,7 +393,12 @@ public class Mahjongg : Gtk.Application
                                 _("_New game"), NoMovesDialogResponse.NEW_GAME,
                                 _("_Shuffle"), NoMovesDialogResponse.SHUFFLE);
 
-            switch (dialog.run ())
+            var result = dialog.run ();
+            /* Shuffling may cause the dialog to appear again immediately,
+               so we destroy BEFORE doing anything with the result. */
+            dialog.destroy ();
+
+            switch (result)
             {
             case NoMovesDialogResponse.UNDO:
                 undo_cb ();
@@ -412,7 +417,6 @@ public class Mahjongg : Gtk.Application
             default:
                 assert_not_reached ();
             }
-            dialog.destroy ();
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]