Distributed Objects on Leopard
Distributed Objects on Leopard
- Subject: Distributed Objects on Leopard
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 21 Feb 2009 00:41:17 +0700
My Cocoa app communicates with a worker thread via NSConnection.
The main thread does:
- (IBAction)getNext:(id)sender;
{
(void)sender;
NiceThing *new = [ theWorker anotherNiceThing: niceThing ];
[ self setValue: new forKey: @"niceThing" ];
}
And the worker thread does:
- (NiceThing *)anotherNiceThing: (in NiceThing *)oldNiceThing;
{
NSUInteger a;
if ( oldNiceThing == nil )
{
a = 0;
}
else
{
SInt32 major;
Gestalt ( gestaltSystemVersionMajor, &major );
SInt32 minor;
Gestalt ( gestaltSystemVersionMinor, &minor );
SInt32 fix;
Gestalt ( gestaltSystemVersionBugFix, &fix );
NSString *v = [ NSString stringWithFormat: @"%d.%d.%d", major,
minor, fix ];
a = [ niceThings indexOfObjectIdenticalTo: oldNiceThing ];
if ( a == NSNotFound ) // error
{
NSLog(@"%s Error: %@ did not find %@ among %@. oldNiceThing %p of
class: %@ is a %s",__FUNCTION__,
v, oldNiceThing, niceThings, oldNiceThing, [oldNiceThing class],
[oldNiceThing isProxy ] ? "Proxy" : "Real" );
return nil;
};
NSLog(@"%s Note: %@ did find %@ at index %lu. oldNiceThing %p of
class: %@ is a %s",__FUNCTION__,
v, oldNiceThing, a, oldNiceThing, [oldNiceThing class],
[oldNiceThing isProxy ] ? "Proxy" : "Real" );
a++;
if ( a >= [ niceThings count ] ) a = 0;
};
NiceThing *new = [ niceThings objectAtIndex: a ];
return new;
}
On Tiger I get:
-[Worker anotherNiceThing:] Note: 10.4.11 did find [NiceThing
0x455790 "หมี"] at index 0. oldNiceThing 0x455790 of class:
NiceThing is a Real
That is: the main thread sends back it's current thing (an NSProxy)
and the worker receives the real thing and finds it in it's array.
But on Leopard I get:
-[Worker anotherNiceThing:] Error: 10.5.6 did not find [NiceThing
0x174200 "หมี"] among
(
[NiceThing 0x174200 "หมี"],
[NiceThing 0x1740b0 "กระต่าย"]
). oldNiceThing 0x17ea30 of class: <NSDistantObject: 0xa05137a0> is a
Proxy
Here we get another NSProxy (a proxy of a proxy) which can not be
found in the array.
Is this new Leopard behaviour a bug or a feature?
And what can I do to get the old Tiger behaviour on Leopard?
Kind regards
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden