[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash when invoking service

From: Richard Frith-Macdonald
Subject: Re: crash when invoking service
Date: Fri, 4 May 2001 05:29:09 +0100

On Thursday, May 3, 2001, at 11:06 PM, Frederic wrote:


When trying to debug the "Service" issue in GSDict, I found a problem in
the function BOOL NSPerformService(NSString *serviceItem, NSPasteboard

In the original code, the "connection" local variable is not initialized
to nil. When the line "connection = [(NSDistantObject*)provider
connectionForProxy];" is executed (arround line 1276), for some reason,
"provider" doesn"t respond to connectionForProxy:. An exception is
raised and, I guess, connection is not set. Then is crashes two line
after at "[connection setRequestTimeout: seconds];". I changed the code
to set connection to nil before the call but when the exception is
raised, connection is set to an invalid value that still leads to the

So my question is: when an exception is raised in a method, what should
the return value of the method be equal to? (especially when it is a

1. I've rewritten this code to cope with the case where an app is providing
a service to itsself ... please try the new version.

2. The exception was raised because, for an app providing the service to itsself,
the 'provider' is a local object rather than a proxy to a remote object.

3. I don't know how you could get a problem a few lines later ... the exception
should cause control to return to the enclosing exception handler.

In answer to your question ... when an exception is raised in a method, there should be *NO* return value from the method because the method does not return. If a method creates an exception handler and calls something that raises an exception inside that handler, then the handler should catch the exception and the method should
then continue to return a value the normal way.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]