Workaround for Bug #3039151

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@774 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-08-04 06:10:27 +00:00
commit 08b94ca321

View file

@ -80,10 +80,15 @@ namespace Greenshot {
// check whether there's an local instance running already // check whether there's an local instance running already
// 1) Create Mutex // 1) Create Mutex
applicationMutex = new Mutex(false, @"Local\F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08"); try {
// 2) Get the right to it, this returns false if it's already locked applicationMutex = new Mutex(false, @"Local\F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08");
if (!applicationMutex.WaitOne(0, false)) { // 2) Get the right to it, this returns false if it's already locked
isAlreadyRunning = true; if (!applicationMutex.WaitOne(0, false)) {
isAlreadyRunning = true;
}
} catch (Exception e) {
LOG.Error("Can't create Mutex, for now we assume it's already there.", e);
isAlreadyRunning = true;
} }
for(int argumentNr = 0; argumentNr < args.Length; argumentNr++) { for(int argumentNr = 0; argumentNr < args.Length; argumentNr++) {