• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Distributed Objects on Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: (no subject)
  • Next by Date: RE: Want to display different views of files/folders (Icon view, list view, thumbnail view ) in the Application Window
  • Previous by thread: Re: Populating a new SQLite Core Data store with default data
  • Next by thread: Question on threads running in my Foundation tool
  • Index(es):
    • Date
    • Thread