From 660716d9f168f8fb3b67efbcd226dfdaef472036 Mon Sep 17 00:00:00 2001 From: RKrom Date: Sat, 7 Aug 2010 15:02:48 +0000 Subject: [PATCH] Merge Branch: Fixed Bug #3039151 git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@792 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Forms/MainForm.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs index aa8943047..bf0fe9680 100644 --- a/Greenshot/Forms/MainForm.cs +++ b/Greenshot/Forms/MainForm.cs @@ -87,8 +87,15 @@ namespace Greenshot { if (!applicationMutex.WaitOne(0, false)) { isAlreadyRunning = true; } + } catch (AbandonedMutexException e) { + // Another Greenshot instance didn't cleanup correctly! + // we can ignore the exception, it happend on the "waitone" but still the mutex belongs to us + LOG.Warn("Greenshot didn't cleanup correctly!", e); + } catch (UnauthorizedAccessException e) { + LOG.Warn("Greenshot is most likely already running for a different user in the same session, can't create mutex due to error: ", e); + isAlreadyRunning = true; } catch (Exception e) { - LOG.Error("Can't create Mutex, for now we assume it's already there.", e); + LOG.Warn("Problem obtaining the Mutex, assuming it was already taken!", e); isAlreadyRunning = true; }