mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-24 18:31:20 +00:00
Fix for lock issue in gui when starting applications on some platforms. Please try and give feedback as this issue is not consistent. Tested by myself and rmottola.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40170 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0b13cd154c
commit
9a8495c0d6
2 changed files with 47 additions and 3 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,12 @@
|
|||
2016-10-24 04:03-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/NSWorkspace.m: Change to GSLaunchd(...) function to
|
||||
correct lock issue which is ocurring on some systems. Added
|
||||
a mutex lock to create a critical section and a retry mechanism
|
||||
in case the distributed lock is not released on the first try.
|
||||
This change appears to correct the issue. Tested by myself and
|
||||
Riccardo.
|
||||
|
||||
2016-10-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSWindow.m (NSMiniWindowView -setImage:): Try to handle
|
||||
|
@ -10,6 +19,7 @@
|
|||
* Source/NSLayoutManager.m: Use the pre-computed advancement
|
||||
instead of calculating it every time.
|
||||
|
||||
>>>>>>> .r40169
|
||||
2016-10-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSLayoutManager.m: Don't try to get the advancement for
|
||||
|
|
|
@ -133,7 +133,11 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
|||
NSString *name;
|
||||
NSDictionary *apps = nil;
|
||||
BOOL modified = NO;
|
||||
unsigned sleeps = 0;
|
||||
NSLock *mlock = nil;
|
||||
|
||||
mlock = [[NSLock alloc] init];
|
||||
[mlock lock]; // start critical section
|
||||
if (path == nil)
|
||||
{
|
||||
path = [NSTemporaryDirectory()
|
||||
|
@ -144,8 +148,6 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
|||
}
|
||||
if ([lock tryLock] == NO)
|
||||
{
|
||||
unsigned sleeps = 0;
|
||||
|
||||
/*
|
||||
* If the lock is really old ... assume the app has died and break it.
|
||||
*/
|
||||
|
@ -256,8 +258,40 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
|||
{
|
||||
[file writeToFile: path atomically: YES];
|
||||
}
|
||||
[lock unlock];
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
sleeps = 0;
|
||||
[lock unlock];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
for (sleeps = 0; sleeps < 10; sleeps++)
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
[lock unlock];
|
||||
NSLog(@"Unlocked %@", lock);
|
||||
break;
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
sleeps++;
|
||||
if (sleeps >= 10)
|
||||
{
|
||||
NSLog(@"Unable to unlock %@", lock);
|
||||
break;
|
||||
}
|
||||
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
|
||||
continue;
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
[mlock unlock]; // end critical section
|
||||
[mlock release];
|
||||
|
||||
if (active == YES)
|
||||
{
|
||||
NSString *activeName = [file objectForKey: @"GSActive"];
|
||||
|
|
Loading…
Reference in a new issue