[chronojump] When deleting a session (for example) makes sure that currentSession = null



commit ee02c8fba8a091eb21364999565a420962bbdc60
Author: Carles Pina i Estany <carles pina cat>
Date:   Tue Nov 1 22:52:20 2016 +0100

    When deleting a session (for example) makes sure that currentSession = null
    
    The new closeSession() method can be called any time that we want to
    close the existing session.

 src/gui/chronojump.cs |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 29d122e..1bfbadb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2412,15 +2412,21 @@ public partial class ChronoJumpWindow
        
        private void on_delete_session_accepted (object o, EventArgs args) 
        {
+               string sessionUniqueID = currentSession.UniqueID.ToString ();
+               closeSession ();
+
+               SqliteSession.DeleteAllStuff(sessionUniqueID);
                new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Deleted session and all its 
tests."));
-               SqliteSession.DeleteAllStuff(currentSession.UniqueID.ToString());
-               
-               sensitiveGuiNoSession();
-               definedSession = false;
+       }
+
+       private void closeSession()
+       {
                app1.Title = progName + "";
+               definedSession = false;
+               currentSession = null;
+               sensitiveGuiNoSession();
        }
 
-       
        private void on_export_session_activate(object o, EventArgs args) {
                ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Encoder data will not be 
exported."), "", "");
                confirmWin.Button_accept.Clicked += new EventHandler(on_export_session_accepted);


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