Newbie question about passing Distributed Objects
Newbie question about passing Distributed Objects
- Subject: Newbie question about passing Distributed Objects
- From: Christian Buggle <email@hidden>
- Date: Thu, 8 Dec 2005 21:25:24 +0100
I am trying to make an NSImage accesible remotely as an DO.
i set up a server, a connection and proxy object like explained in
the DO-docs. Accessing the server through the proxy object is up and
working.
A String is successfully returned, however the same thing doesn't
work with NSImage. When returning the image, the server code seemes
to complete successfully, theImage on client side is even created
(i.e. no longer nil) but has invalid dimensions. (width
9.18382988e-41 ...)
I tried copy the myServerImage instead of just returning it, i tried
to allocate the memory before reuqesting theImage and i also tried
explicitly retaining it, (both, on server side and on client side -
after all i'm not even 100% sure this is an DO problem rather than a
memory allocation error). I also tried to set up myServerImage as
rootproxy of the connection itself. No difference.
I tried to understand what's going on reading about copyWithZone,
NSProxy, NSConnections, Serialization, DO in general, etc
Can someone tell me what's wrong or at least point me to the right
starting point in the docs or some sample code?
thanks
Christian
--
### Server code:
-(NSImage*) getImageFromServer{
return myServerImage;
}
-(NSString*) ask:(NSString*)question {
NSLog(question);
return @"this works"
}
### client code: ###
-(NSImage*) getImageFromServer{
answer = [theProxy ask:@"hello"];
NSLog(answer);
// works until here
theImage = [theProxy getImage];
// theImage is now no longer nil, but has invalid dimensions.
return theImage;
}
###
this is the stack trace after client tries to return theImage:
#0 0xbfffdca0 in ??
#1 0x90015d34 in malloc_zone_calloc
#2 0x909c2354 in _internal_class_createInstanceFromZone
#3 0x909c487c in _internal_object_copyFromZone
#4 0x928f45b8 in NSCopyObject
#5 0x9371e380 in -[NSImage copyWithZone:]
#6 0x909c4214 in objc_msgSendv
#7 0x928da380 in -[NSInvocation invoke]
#8 0x928d9c8c in -[NSConnection dispatchInvocation:]
#9 0x928d7d98 in -[NSConnection handleRequest:sequence:]
#10 0x928d770c in -[NSConnection handlePortCoder:]
#11 0x928d7478 in -[NSConcretePortCoder dispatch]
#12 0x928d6e58 in __NSFireMachPort
#13 0x9076adbc in __CFMachPortPerform
#14 0x9076acd0 in __CFRunLoopDoSource1
#15 0x9075d3e8 in __CFRunLoopRun
#16 0x9075ca18 in CFRunLoopRunSpecific
#17 0x931861e0 in RunCurrentEventLoopInMode
#18 0x93185874 in ReceiveNextEventCommon
#19 0x931856e0 in BlockUntilNextEventMatchingListInMode
#20 0x93684904 in _DPSNextEvent
#21 0x936845c8 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#22 0x93680b0c in -[NSApplication run]
#23 0x93771618 in NSApplicationMain
#24 0x00011fac in main at main.m:15
_______________________________________________
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