Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: Question about cast_spell()



When I posted the patch for create_missile() a few weeks ago, I
described what was the source of the problem: in cast_spell(), a
temporary copy of the object is created on the stack (only if the
spell comes from a scroll, rod or wand) and freed when the function
returns.  The problem was that create_missile() was using a reference
to that temporary object when picking up the arrows, with nasty
consequences when that (invalid) pointer was used later in
process_events().

Well, it looks like another spell is doing the same thing.  :-(  I got
a server crash and the core dump showed me that one of the objects in
the active list was a pointer to the stack.  Alas, I haven't been able
to reproduce it and I don't know which spell caused that (it happened
while a big wizard was casting lots of spells).

So I would like to know when the "temporary object" stuff was added in
cast_spell() and if its only purpose is to adjust the caster's level
to that of the scroll, rod or wand.  Is the author of that code
reading this?

That bug is rather nasty, so I would like to change the code in
cast_spell() so that it doesn't use a temporary copy of the object
(instead, I could just modify the caster's level and restore it when
exiting cast_spell()).  But I want to be sure that I will not break
anything else, that's why I am asking first.

-Raphael