mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Fix for apps providing services to self.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9772 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
983262867b
commit
ed14212586
2 changed files with 23 additions and 27 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
* Source/NSCursor.m: Corrected illegal use of reserved word (id)
|
||||
as method argument ... gcc-3 doesn't allow it.
|
||||
* Source/GSServicesManager.m: GSContactApplication() fix to return our
|
||||
own listener if contacting self. NSPerformService() commented, tidied,
|
||||
and fixed to cope with case where the service provider is this app.
|
||||
|
||||
2001-05-03 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -1147,11 +1147,11 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
id
|
||||
GSContactApplication(NSString *appName, NSString *port, NSDate *expire)
|
||||
{
|
||||
id app;
|
||||
id app;
|
||||
|
||||
if (providerName != nil && [port isEqual: providerName] == YES)
|
||||
{
|
||||
app = servicesProvider;
|
||||
app = [GSListener listener]; // Contect our own listener.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1213,12 +1213,9 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
|||
NSDate *finishBy;
|
||||
NSString *appPath;
|
||||
id provider;
|
||||
NSConnection *connection;
|
||||
NSString *message;
|
||||
NSString *selName;
|
||||
SEL msgSel;
|
||||
NSString *userData;
|
||||
IMP msgImp;
|
||||
NSString *error = nil;
|
||||
|
||||
service = [[manager menuServices] objectForKey: serviceItem];
|
||||
|
@ -1245,24 +1242,11 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
|||
userData = [service objectForKey: @"NSUserData"];
|
||||
message = [service objectForKey: @"NSMessage"];
|
||||
selName = [message stringByAppendingString: @":userData:error:"];
|
||||
msgSel = NSSelectorFromString(selName);
|
||||
|
||||
/*
|
||||
* If there is no selector - we need to generate one with the
|
||||
* appropriate types.
|
||||
* Locate the service provider ... this will be a proxy to the remote
|
||||
* object, or a local object (if we provide the service ourself)
|
||||
*/
|
||||
if (msgSel == 0)
|
||||
{
|
||||
NSMethodSignature *sig;
|
||||
const char *name;
|
||||
const char *type;
|
||||
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: "v@:@@^@"];
|
||||
type = [sig methodType];
|
||||
name = [selName cString];
|
||||
msgSel = sel_register_typed_name(name, type);
|
||||
}
|
||||
|
||||
provider = GSContactApplication(appPath, port, finishBy);
|
||||
if (provider == nil)
|
||||
{
|
||||
|
@ -1273,20 +1257,29 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
|||
return NO;
|
||||
}
|
||||
|
||||
connection = [(NSDistantObject*)provider connectionForProxy];
|
||||
seconds = [finishBy timeIntervalSinceNow];
|
||||
[connection setRequestTimeout: seconds];
|
||||
[connection setReplyTimeout: seconds];
|
||||
/*
|
||||
* If the service provider is a remote object, we can set timeouts on
|
||||
* the NSConnection so we don't hang waiting for it to reply.
|
||||
*/
|
||||
if ([provider isProxy] == YES)
|
||||
{
|
||||
NSConnection *connection;
|
||||
|
||||
msgImp = get_imp(GSObjCClass(provider), msgSel);
|
||||
connection = [(NSDistantObject*)provider connectionForProxy];
|
||||
seconds = [finishBy timeIntervalSinceNow];
|
||||
[connection setRequestTimeout: seconds];
|
||||
[connection setReplyTimeout: seconds];
|
||||
}
|
||||
|
||||
/*
|
||||
* At last, we ask for the service to be performed.
|
||||
*/
|
||||
NS_DURING
|
||||
{
|
||||
[provider performService: selName
|
||||
withPasteboard: pboard
|
||||
userData: userData
|
||||
error: &error];
|
||||
|
||||
// (*msgImp)(provider, msgSel, pboard, userData, &error);
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue