mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
Fix for multiple startup.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16410 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b2c12040e5
commit
aa2355943a
2 changed files with 38 additions and 35 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
* Source/GSServicesManager.m: on opening file, only activate for
|
* Source/GSServicesManager.m: on opening file, only activate for
|
||||||
document based applications as suggested by Alexander.
|
document based applications as suggested by Alexander.
|
||||||
|
* Source/NSWorkspace.m: ([_connectApplication:]) fix to handle
|
||||||
|
retries and timeouts correctly.
|
||||||
|
|
||||||
2003-04-10 01:53 Alexander Malmberg <alexander@malmberg.org>
|
2003-04-10 01:53 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
|
|
@ -1908,10 +1908,9 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
NSString *host;
|
NSString *host;
|
||||||
NSString *port;
|
NSString *port;
|
||||||
NSDate *when = nil;
|
NSDate *when = nil;
|
||||||
BOOL done = NO;
|
|
||||||
id app = nil;
|
id app = nil;
|
||||||
|
|
||||||
while (done == NO)
|
while (app == nil)
|
||||||
{
|
{
|
||||||
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||||
if (host == nil)
|
if (host == nil)
|
||||||
|
@ -1944,51 +1943,53 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
|
|
||||||
done = YES;
|
|
||||||
if (app == nil)
|
if (app == nil)
|
||||||
{
|
{
|
||||||
NSTask *task = [_launched objectForKey: appName];
|
NSTask *task = [_launched objectForKey: appName];
|
||||||
|
NSDate *limit;
|
||||||
|
|
||||||
if (task != nil && [task isRunning] == YES)
|
if (task == nil || [task isRunning] == NO)
|
||||||
{
|
{
|
||||||
if (when == nil)
|
if (task != nil) // Not running
|
||||||
{
|
{
|
||||||
when = [[NSDate alloc] init];
|
[_launched removeObjectForKey: appName];
|
||||||
done = NO;
|
|
||||||
}
|
}
|
||||||
else if ([when timeIntervalSinceNow] > 5.0)
|
break; // Need to launch the app
|
||||||
|
}
|
||||||
|
|
||||||
|
if (when == nil)
|
||||||
|
{
|
||||||
|
when = [[NSDate alloc] init];
|
||||||
|
}
|
||||||
|
else if ([when timeIntervalSinceNow] < -5.0)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
DESTROY(when);
|
||||||
|
result = NSRunAlertPanel(appName,
|
||||||
|
@"Application seems to have hung",
|
||||||
|
@"Continue", @"Terminate", @"Wait");
|
||||||
|
|
||||||
|
if (result == NSAlertDefaultReturn)
|
||||||
{
|
{
|
||||||
int result;
|
break; // Finished without app
|
||||||
|
|
||||||
DESTROY(when);
|
|
||||||
result = NSRunAlertPanel(appName,
|
|
||||||
@"Application seems to have hung",
|
|
||||||
@"Continue", @"Terminate", @"Wait");
|
|
||||||
|
|
||||||
if (result == NSAlertDefaultReturn)
|
|
||||||
{
|
|
||||||
done = YES;
|
|
||||||
}
|
|
||||||
else if (result == NSAlertOtherReturn)
|
|
||||||
{
|
|
||||||
done = NO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[task terminate];
|
|
||||||
[_launched removeObjectForKey: appName];
|
|
||||||
done = YES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (done == NO)
|
else if (result == NSAlertOtherReturn)
|
||||||
{
|
{
|
||||||
NSDate *limit;
|
// Continue to wait for app startup.
|
||||||
|
}
|
||||||
limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.5];
|
else
|
||||||
[[NSRunLoop currentRunLoop] runUntilDate: limit];
|
{
|
||||||
RELEASE(limit);
|
[task terminate];
|
||||||
|
[_launched removeObjectForKey: appName];
|
||||||
|
break; // Terminate hung app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Give it another 0.5 of a second to start up.
|
||||||
|
limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.5];
|
||||||
|
[[NSRunLoop currentRunLoop] runUntilDate: limit];
|
||||||
|
RELEASE(limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TEST_RELEASE(when);
|
TEST_RELEASE(when);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue