>>>> "GE" == Gunnar Evermann
<ge204(a)eng.cam.ac.uk> writes:
GE> Martin Buchholz <martin(a)xemacs.org> writes:
> I can't try to reproduce your crash directly since I
don't have
> clearcase, but...your backtrace looks very suggestive, so...
> GCPROs are very tricky.
GE> yes, indeed. Maybe Ray could build with DEBUG_GCPRO and then call
GE> show_gcprohist(). It seemed that one gcpro struct in the gcprolist was
GE> pointing to NULL, which shouldn't happen.
I've never used DEBUG_GCPRO.
> - Lisp_Object handler;
> + Lisp_Object handler = Qnil;
GE> out of interest, is this always neccessary? Hm, I guess it is. Maybe
GE> the actual bug is of this kind -- GCPROing an unintialised variable.
When you GCPRO, your variables had better be initialized. Or at least
when you gc. Even if you never actually use the variable you GCPROed.
> /* both of these get set below */
> - GCPRO2 (name, default_directory);
> + GCPRO3 (name, default_directory, handler);
>
> CHECK_STRING (name);
>
> @@ -777,9 +777,8 @@
> handler = Ffind_file_name_handler (name, Qexpand_file_name);
> if (!NILP (handler))
> {
> - UNGCPRO;
> - return call3_check_string (handler, Qexpand_file_name, name,
> - default_directory);
> + RETURN_UNGCPRO (call3_check_string (handler, Qexpand_file_name,
> + name, default_directory));
GE> I agree with the RETURN_UNGCPRO but don't think any of this is going
GE> to make a difference. handler should be GCPRO'd by call3().
No!
The old code carefully UNGCPRO'ed, and then used the unprotected
variables.
RETURN_UNCGPRO is not just syntactic sugar here. It evaluates the call to
call3, during which time GCPRO is still in effect, then UNGCPROs and
returns the result.
I don't know whether the crash here was caused by unprotected handler,
or by unprotected call3, or even if my patch actually fixes the problem.
Martin