diff --git a/Greenshot/Forms/CaptureForm.cs b/Greenshot/Forms/CaptureForm.cs index 4e083e37d..1f4c962a9 100644 --- a/Greenshot/Forms/CaptureForm.cs +++ b/Greenshot/Forms/CaptureForm.cs @@ -94,7 +94,7 @@ namespace Greenshot.Forms { LOG.Debug("Data received, Command = " + dataTransport.Command + ", Data: " + dataTransport.CommandData); switch(dataTransport.Command) { case CommandEnum.Exit: - Application.Exit(); + MainForm.instance.exit(); break; case CommandEnum.ReloadConfig: AppConfig.Reload(); diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs index cd39300dd..b9a0adb52 100644 --- a/Greenshot/Forms/MainForm.cs +++ b/Greenshot/Forms/MainForm.cs @@ -137,6 +137,7 @@ namespace Greenshot { // unregister application on uninstall (allow uninstall) if (argument.Equals("--uninstall") || argument.Equals("uninstall")) { try { + LOG.Info("Sending all instances the exit command."); // Pass Exit to running instance, if any dataTransport = new DataTransport(CommandEnum.Exit, args[0]); SendData(dataTransport); @@ -431,7 +432,6 @@ namespace Greenshot { void Contextmenu_exitClick(object sender, EventArgs e) { exit(); - Application.Exit(); } private void InitializeQuickSettingsMenu() { @@ -536,12 +536,12 @@ namespace Greenshot { /// /// Exit/cleanup /// - private void exit() { + public void exit() { // Inform all registed plugins PluginHelper.instance.Shutdown(); // Make the Greenshot icon invisible - notifyIcon.Visible = true; + notifyIcon.Visible = false; conf.Store(); HotkeyHelper.UnregisterHotkeys((int)this.Handle); @@ -553,6 +553,7 @@ namespace Greenshot { LOG.Error("Error releasing Mutex!", ex); } } + Application.Exit(); } } }