Fix forwarding of methods not in the proxies protocl if a protocol is set.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19826 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2004-08-05 00:03:30 +00:00
parent 9b216878ea
commit a9cde13d8e
2 changed files with 26 additions and 13 deletions

View file

@ -1,3 +1,11 @@
2004-08-05 01:59 Alexander Malmberg <alexander@malmberg.org>
* Source/NSDistantObject.m (DO_FORWARD_INVOCATION): Warning if we
can't do the forwarding.
(-methodSignatureForSelector:): If a protocol has been set but
doesn't contain info about the selector, forward the request to
the other end of the connection.
2004-08-04 David Ayers <d.ayers@inode.at> 2004-08-04 David Ayers <d.ayers@inode.at>
* Testing/nsmethodsignature.m: New test. * Testing/nsmethodsignature.m: New test.

View file

@ -28,6 +28,7 @@
#include "config.h" #include "config.h"
#include "GNUstepBase/preface.h" #include "GNUstepBase/preface.h"
#include "GNUstepBase/DistributedObjects.h" #include "GNUstepBase/DistributedObjects.h"
#include "Foundation/NSDebug.h"
#include "Foundation/NSLock.h" #include "Foundation/NSLock.h"
#include "Foundation/NSPort.h" #include "Foundation/NSPort.h"
#include "Foundation/NSMethodSignature.h" #include "Foundation/NSMethodSignature.h"
@ -37,13 +38,20 @@
#define DO_FORWARD_INVOCATION(_SELX, _ARG1) ({ \ #define DO_FORWARD_INVOCATION(_SELX, _ARG1) ({ \
sig = [self methodSignatureForSelector: @selector(_SELX)]; \ sig = [self methodSignatureForSelector: @selector(_SELX)]; \
if (sig != nil) { \ if (sig != nil) \
inv = [NSInvocation invocationWithMethodSignature: sig]; \ { \
[inv setSelector: @selector(_SELX)]; \ inv = [NSInvocation invocationWithMethodSignature: sig]; \
[inv setTarget: self]; \ [inv setSelector: @selector(_SELX)]; \
[inv setArgument: (void*)&_ARG1 atIndex: 2]; \ [inv setTarget: self]; \
[self forwardInvocation: inv]; \ [inv setArgument: (void*)&_ARG1 atIndex: 2]; \
[inv getReturnValue: &m]; }}) [self forwardInvocation: inv]; \
[inv getReturnValue: &m]; \
} \
else \
{ \
NSWarnLog(@"DO_FORWARD_INVOCATION failed, got nil signature for '%@'.", \
NSStringFromSelector(@selector(_SELX))); \
}})
static int debug_proxy = 0; static int debug_proxy = 0;
@ -716,13 +724,10 @@ enum
{ {
types = mth->types; types = mth->types;
} }
if (types == 0) if (types)
{ return [NSMethodSignature signatureWithObjCTypes: types];
return nil;
}
return [NSMethodSignature signatureWithObjCTypes: types];
} }
else
{ {
id m = nil; id m = nil;
#if defined(USE_FFCALL) || defined(USE_LIBFFI) #if defined(USE_FFCALL) || defined(USE_LIBFFI)