Merge from branch for Exit problems

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@743 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-07-30 16:05:44 +00:00
commit f84b227d47

View file

@ -537,23 +537,34 @@ namespace Greenshot {
/// Exit/cleanup /// Exit/cleanup
/// </summary> /// </summary>
public void exit() { public void exit() {
// Inform all registed plugins try {
PluginHelper.instance.Shutdown(); // Make sure hotkeys are disabled
HotkeyHelper.UnregisterHotkeys((int)this.Handle);
// Make the Greenshot icon invisible // Now the sound isn't needed anymore
notifyIcon.Visible = false; SoundHelper.Deinitialize();
conf.Store(); // Making sure all Windows are closed, gracefull shutdown
HotkeyHelper.UnregisterHotkeys((int)this.Handle); Application.Exit();
SoundHelper.Deinitialize();
if (applicationMutex != null) { // Inform all registed plugins
try { PluginHelper.instance.Shutdown();
applicationMutex.ReleaseMutex();
} catch (Exception ex) { // Store any open configuration changes
LOG.Error("Error releasing Mutex!", ex); conf.Store();
} finally {
// Remove the application mutex
if (applicationMutex != null) {
try {
applicationMutex.ReleaseMutex();
} catch (Exception ex) {
LOG.Error("Error releasing Mutex!", ex);
}
} }
// make the icon invisible otherwise it stays even after exit!!
notifyIcon.Visible = false;
} }
Application.Exit();
} }
} }
} }