From: Lars Op den Kamp Date: Fri, 8 Mar 2013 10:27:02 +0000 (+0100) Subject: ensure that the tray app only initialises once. bugzid: 2082 X-Git-Tag: upstream/2.2.0~1^2~5^2~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=28fbb19327c05b5440bae1d74088cad76e4c4c0d;p=deb_libcec.git ensure that the tray app only initialises once. bugzid: 2082 --- diff --git a/src/LibCecTray/controller/CECController.cs b/src/LibCecTray/controller/CECController.cs index c1a6ed3..94fac2e 100644 --- a/src/LibCecTray/controller/CECController.cs +++ b/src/LibCecTray/controller/CECController.cs @@ -203,6 +203,11 @@ namespace LibCECTray.controller /// 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; } /// @@ -519,6 +525,7 @@ namespace LibCECTray.controller private readonly CECTray _gui; public Actions CECActions; private bool _deviceChangeWarningDisplayed; + private bool _initialised; #endregion }