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
This commit is contained in:
RKrom 2010-07-27 19:12:34 +00:00
commit 01c02d9f99

View file

@ -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);
}
/// <summary>
/// Exit/cleanup
/// </summary>
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);
}
}
}
}
}