Distributed Objects: problem with bycopy not working as expected
Distributed Objects: problem with bycopy not working as expected
- Subject: Distributed Objects: problem with bycopy not working as expected
- From: Charles Crowley <email@hidden>
- Date: Mon, 24 Jan 2005 11:23:28 -0700
I have a DO program mostly working but have run across something
unexpected. The following code is one of the methods in the server of a
distributed object. The client makes this call and it gets to the
server as expected.
- (oneway void) registerObserver: (in bycopy ObserverData *)
inObserverData {
BOOL isProxy = [inObserverData isProxy];
if( isProxy ) {
NSLog(@"registerObserver: argument is a proxy");
...
//NSLog(@"%@: registerObserver: %@ isProxy=%d", self, observerData,
isProxy);
//NSConnection * connection = [(NSDistantObject *)inObserverData
connectionForProxy];
//NSLog(@"--NSProxy: retainCount=%d connection=%@",
//[inObserverData retainCount], connection);
}
...
}
I make the "inObserverData" object "bycopy" because I always use all of
the fields in it.
By my understanding of what "bycopy" means, I should always get a copy
of the object and never a proxy for it. But when I run the program
"isProxy" is true and the NSLog statement is executed.
If I then create a local ObserverData and copy the fields from the
proxy one at a time the rest of the code works fine. But if I uncomment
the three commented lines inside the "if( isProxy )" statement the
program crashes, apparently in processing the autorelease pool. It
seems like this might be related.
Am I misunderstanding how "bycopy" is supposed to work or is there
something else wrong?
Thanks, Charlie Crowley
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden