[longomatch] Ensure proper widget destruction on application quit.



commit 27d03bc7edf4f56710de91d87212d1a09b9f5253
Author: Julien Moutte <julien fluendo com>
Date:   Fri May 1 10:19:45 2015 +0200

    Ensure proper widget destruction on application quit.
    
    When the application is quitting while we are on the new project panel we need to properly destroy 
widgets.
    To do that we go back to the welcome panel, a little bit like the analysis window closes the opened 
project first.
    This should fix the long shutdown issue happening when MONO is waiting for OPE threads in the video 
synchronisation widget.

 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index a365d13..0203dde 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -98,8 +98,11 @@ namespace LongoMatch.Gui.Panel
 
                protected override void OnDestroyed ()
                {
+                       Config.EventsBroker.QuitApplicationEvent -= HandleQuit;
+
                        teamtagger.Dispose ();
                        projectperiods1.Destroy ();
+
                        base.OnDestroyed ();
                }
 
@@ -211,6 +214,7 @@ namespace LongoMatch.Gui.Panel
                        capturemediafilechooser.ChangedEvent += HandleEntryChanged;
                        tagscombobox.Changed += HandleSportsTemplateChanged;
                        devicecombobox.Changed += HandleDeviceChanged;
+                       Config.EventsBroker.QuitApplicationEvent += HandleQuit;
                }
 
                void FillProjectDetails ()
@@ -523,6 +527,15 @@ namespace LongoMatch.Gui.Panel
                        HandleNextClicked (this, e);
                }
 
+               void HandleQuit ()
+               {
+                       // When the application is quitting while we are on the new project panel we need to 
properly destroy widgets.
+                       // To do that we go back to the welcome panel, a little bit like the analysis window 
closes the opened project first.
+                       if (BackEvent != null) {
+                               BackEvent ();
+                       }
+               }
+
                void HandleBackClicked (object sender, EventArgs e)
                {
                        if (notebook1.Page == PROJECT_PERIODS) {


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