don't crash on exit in cectray by preventing a new action from being started
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 09:50:11 +0000 (10:50 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 09:50:11 +0000 (10:50 +0100)
src/LibCecTray/controller/Actions.cs
src/LibCecTray/ui/CECTray.cs

index 13dc92035be67a078ffb42660552a6d98c78baf8..2970ede803824a9a3af27b3acb6380e41634e719 100644 (file)
@@ -94,7 +94,7 @@ namespace LibCECTray.controller
           _controller.CheckActiveDevices();
           break;
         case UpdateEventType.ProcessCompleted:
-          if (!(_activeProcess is GetCurrentPhysicalAddress))
+          if (!(_activeProcess is GetCurrentPhysicalAddress) && !SuppressUpdates)
           {
             _activeProcess = new GetCurrentPhysicalAddress(_controller.Lib);
             _activeProcess.EventHandler += ProcessEventHandler;
@@ -123,6 +123,7 @@ namespace LibCECTray.controller
 
           break;
         case UpdateEventType.ExitApplication:
+          SuppressUpdates = true;
           _activeProcess = null;
           Application.Exit();
           break;
index ab046623d1cdc9e91c426a024dcb17578f3d5ca2..8df996ecc374d6e786f3a0f526bcc2e3c472949c 100644 (file)
@@ -79,6 +79,7 @@ namespace LibCECTray.ui
 
     public void OnSessionEnding(object sender, SessionEndingEventArgs e)
     {
+      Controller.CECActions.SuppressUpdates = true;
       Controller.Close();
     }
 
@@ -175,6 +176,7 @@ namespace LibCECTray.ui
       Hide();
       if (disposing)
       {
+        Controller.CECActions.SuppressUpdates = true;
         Controller.Close();
       }
       if (disposing && (components != null))