ensure that the tray app only initialises once. bugzid: 2082
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 8 Mar 2013 10:27:02 +0000 (11:27 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 8 Mar 2013 12:51:34 +0000 (13:51 +0100)
src/LibCecTray/controller/CECController.cs

index c1a6ed32e29c26411121a2686d0e8709d680488a..94fac2e4349e0bc4c76ecb83aab13f2ac6f8232e 100644 (file)
@@ -203,6 +203,11 @@ namespace LibCECTray.controller
     /// </summary>
     public void Initialise()
     {
+      // only load once
+      if (_initialised)
+        return;
+      _initialised = true;
+
       CECActions.ConnectToDevice(Config);
       Applications.Initialise(this);
     }
@@ -215,6 +220,7 @@ namespace LibCECTray.controller
       Lib.DisableCallbacks();
       Lib.StandbyDevices(CecLogicalAddress.Broadcast);
       Lib.Close();
+      _initialised = false;
     }
 
     /// <summary>
@@ -519,6 +525,7 @@ namespace LibCECTray.controller
     private readonly CECTray _gui;
     public Actions CECActions;
     private bool _deviceChangeWarningDisplayed;
+    private bool _initialised;
 
     #endregion
   }