mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Keep launched applications more up to date when apps crash.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25369 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2d859c1d21
commit
d35f7c179c
2 changed files with 53 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-08-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m: ([-launchedApplications]) check that each app
|
||||
is still responding if it's more than 30 seconds since the last check.
|
||||
|
||||
2007-07-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSColorPanel.h: Add constant for
|
||||
|
|
|
@ -1413,23 +1413,64 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
|||
*/
|
||||
- (NSArray*) launchedApplications
|
||||
{
|
||||
id app;
|
||||
static NSDate *lastCheck = nil;
|
||||
NSArray *apps = nil;
|
||||
unsigned count;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
id app;
|
||||
|
||||
if ((app = [self _workspaceApplication]) != nil)
|
||||
{
|
||||
NSArray *result;
|
||||
|
||||
result = [app launchedApplications];
|
||||
NS_VALRETURN(result);
|
||||
apps = [app launchedApplications];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
// workspace manager problem ... fall through to default code
|
||||
{
|
||||
// workspace manager problem ... fall through to default code
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
if (apps == nil)
|
||||
{
|
||||
apps = GSLaunched(nil, NO);
|
||||
}
|
||||
|
||||
return GSLaunched(nil, NO);
|
||||
/* If it's over 30 seconds since the last check ... try to contact
|
||||
* all launched applications to ensure that none have crashed.
|
||||
*/
|
||||
if (lastCheck != nil && [lastCheck timeIntervalSinceNow] > -30.0)
|
||||
{
|
||||
return apps;
|
||||
}
|
||||
ASSIGN(lastCheck, [NSDate date]);
|
||||
|
||||
count = [apps count];
|
||||
while (count-- > 0)
|
||||
{
|
||||
NSString *name;
|
||||
|
||||
name = [[apps objectAtIndex: count] objectForKey: @"NSApplicationName"];
|
||||
if (name != nil)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
BOOL found = NO;
|
||||
|
||||
if ([self _connectApplication: name] != nil)
|
||||
{
|
||||
found = YES;
|
||||
}
|
||||
RELEASE(arp);
|
||||
if (found == NO)
|
||||
{
|
||||
NSMutableArray *m = [apps mutableCopy];
|
||||
|
||||
[m removeObjectAtIndex: count];
|
||||
apps = AUTORELEASE(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
return apps;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue