mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 00:40:48 +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
9a2711f728
commit
bd27fa12ac
2 changed files with 23 additions and 27 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
* Source/NSCursor.m: Corrected illegal use of reserved word (id)
|
* Source/NSCursor.m: Corrected illegal use of reserved word (id)
|
||||||
as method argument ... gcc-3 doesn't allow it.
|
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>
|
2001-05-03 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -1147,11 +1147,11 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
id
|
id
|
||||||
GSContactApplication(NSString *appName, NSString *port, NSDate *expire)
|
GSContactApplication(NSString *appName, NSString *port, NSDate *expire)
|
||||||
{
|
{
|
||||||
id app;
|
id app;
|
||||||
|
|
||||||
if (providerName != nil && [port isEqual: providerName] == YES)
|
if (providerName != nil && [port isEqual: providerName] == YES)
|
||||||
{
|
{
|
||||||
app = servicesProvider;
|
app = [GSListener listener]; // Contect our own listener.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1213,12 +1213,9 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
||||||
NSDate *finishBy;
|
NSDate *finishBy;
|
||||||
NSString *appPath;
|
NSString *appPath;
|
||||||
id provider;
|
id provider;
|
||||||
NSConnection *connection;
|
|
||||||
NSString *message;
|
NSString *message;
|
||||||
NSString *selName;
|
NSString *selName;
|
||||||
SEL msgSel;
|
|
||||||
NSString *userData;
|
NSString *userData;
|
||||||
IMP msgImp;
|
|
||||||
NSString *error = nil;
|
NSString *error = nil;
|
||||||
|
|
||||||
service = [[manager menuServices] objectForKey: serviceItem];
|
service = [[manager menuServices] objectForKey: serviceItem];
|
||||||
|
@ -1245,24 +1242,11 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
||||||
userData = [service objectForKey: @"NSUserData"];
|
userData = [service objectForKey: @"NSUserData"];
|
||||||
message = [service objectForKey: @"NSMessage"];
|
message = [service objectForKey: @"NSMessage"];
|
||||||
selName = [message stringByAppendingString: @":userData:error:"];
|
selName = [message stringByAppendingString: @":userData:error:"];
|
||||||
msgSel = NSSelectorFromString(selName);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there is no selector - we need to generate one with the
|
* Locate the service provider ... this will be a proxy to the remote
|
||||||
* appropriate types.
|
* 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);
|
provider = GSContactApplication(appPath, port, finishBy);
|
||||||
if (provider == nil)
|
if (provider == nil)
|
||||||
{
|
{
|
||||||
|
@ -1273,20 +1257,29 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = [(NSDistantObject*)provider connectionForProxy];
|
/*
|
||||||
seconds = [finishBy timeIntervalSinceNow];
|
* If the service provider is a remote object, we can set timeouts on
|
||||||
[connection setRequestTimeout: seconds];
|
* the NSConnection so we don't hang waiting for it to reply.
|
||||||
[connection setReplyTimeout: seconds];
|
*/
|
||||||
|
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
|
NS_DURING
|
||||||
{
|
{
|
||||||
[provider performService: selName
|
[provider performService: selName
|
||||||
withPasteboard: pboard
|
withPasteboard: pboard
|
||||||
userData: userData
|
userData: userData
|
||||||
error: &error];
|
error: &error];
|
||||||
|
|
||||||
// (*msgImp)(provider, msgSel, pboard, userData, &error);
|
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue