Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

installer: introduce AppMutex for thgstakbar on installer

- avoid installing when thgtaskbar is running
- avoid starting a second instance of thgtaskbar

See http://www.jrsoftware.org/iskb.php?mutexsessions

Changeset 4634a1bf3be5

Parent 7d026a991cde

by Adrian Buehlmann

Changes to 2 files · Browse files at 4634a1bf3be5 Showing diff from parent 7d026a991cde Diff from another changeset...

 
14
15
16
 
17
18
19
 
14
15
16
17
18
19
20
@@ -14,6 +14,7 @@
 AppUpdatesURL=http://bitbucket.org/tortoisehg/stable/  AppID=TortoiseHg  AppContact=teekaysoh@gmail.com +AppMutex=thgtaskbar,Global\thgtaskbar  OutputBaseFilename=TortoiseHg-0.8  DefaultDirName={pf}\TortoiseHg  SourceDir=..\..
Change 1 of 2 Show Entire File thgtaskbar.py Stacked
 
17
18
19
 
20
21
22
 
420
421
422
 
 
423
 
 
 
 
 
 
 
 
424
425
426
 
17
18
19
20
21
22
23
 
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
@@ -17,6 +17,7 @@
 import win32file  import winerror  import pywintypes +import win32security    from mercurial import demandimport  demandimport.ignore.append('win32com.shell') @@ -420,7 +421,17 @@
  # Clean up when we exit   self.SvcStop()   +MUTEXNAME = 'thgtaskbar' +  def main(): + sa = win32security.SECURITY_ATTRIBUTES() + sa.SetSecurityDescriptorDacl (1, None, 0) # allow full access + mutex1 = win32event.CreateMutex(sa, 1, MUTEXNAME) + if GetLastError() == winerror.ERROR_ALREADY_EXISTS: + print "another instance is already running" + return + # see http://www.jrsoftware.org/iskb.php?mutexsessions + mutex2 = win32event.CreateMutex(sa, 1, 'Global\\' + MUTEXNAME)   w=MainWindow()   PumpMessages()