From 01c02d9f99919bea765b8aecc4dd580040290e64 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 27 Jul 2010 19:12:34 +0000 Subject: [PATCH] Fixed exit bug (no cleanup being made) git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@720 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Forms/MainForm.cs | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs index 00144b8f5..40760c152 100644 --- a/Greenshot/Forms/MainForm.cs +++ b/Greenshot/Forms/MainForm.cs @@ -328,20 +328,7 @@ namespace Greenshot { #region mainform events void MainFormFormClosing(object sender, FormClosingEventArgs e) { LOG.Info("Closing with reason: " + e.CloseReason); - - // Inform all registed plugins - PluginHelper.instance.Shutdown(); - - conf.Store(); - HotkeyHelper.UnregisterHotkeys((int)this.Handle); - SoundHelper.Deinitialize(); - if (applicationMutex != null) { - try { - applicationMutex.ReleaseMutex(); - } catch (Exception ex) { - LOG.Error("Error releasing Mutex!", ex); - } - } + exit(); } #endregion @@ -435,6 +422,7 @@ namespace Greenshot { } void Contextmenu_exitClick(object sender, EventArgs e) { + exit(); Application.Exit(); } @@ -536,5 +524,24 @@ namespace Greenshot { private void ImageWritten(object sender, ImageOutputEventArgs eventArgs) { lastImagePath = Path.GetDirectoryName(eventArgs.FullPath); } + + /// + /// Exit/cleanup + /// + private void exit() { + // Inform all registed plugins + PluginHelper.instance.Shutdown(); + + conf.Store(); + HotkeyHelper.UnregisterHotkeys((int)this.Handle); + SoundHelper.Deinitialize(); + if (applicationMutex != null) { + try { + applicationMutex.ReleaseMutex(); + } catch (Exception ex) { + LOG.Error("Error releasing Mutex!", ex); + } + } + } } }