[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: crash when invoking service
From: |
Frederic |
Subject: |
Re: crash when invoking service |
Date: |
Sat, 05 May 2001 22:59:15 +0200 |
Richard Frith-Macdonald a écrit :
>
> On Thursday, May 3, 2001, at 11:06 PM, Frederic wrote:
>
> > Hello,
> >
> > When trying to debug the "Service" issue in GSDict, I found a problem in
> > the function BOOL NSPerformService(NSString *serviceItem, NSPasteboard
> > *pboard):
> >
> > 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
> > crash.
> >
> > 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
> > pointer)
>
> 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.
It works now much much better. Thanks for the fix. The service is now
fully useable.
I also had to add a line in my code before opening a new window when the
service is being called from another process:
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
This was made necessary because an application refuses to open a new
NSDocument and display its window if the application is not the active
one.
Does this behavior follow the specifications?
I have uploaded the corrected version on the web site.
Frederic