[sword-devel] BUG in general book support

Joachim Ansorg sword-devel@crosswire.org
Wed, 27 Feb 2002 14:55:20 +0100


Troy, 
	thank you for writing back!

> target->SetKey((SWKey*)*target);
>
> The problem is that you are extracting a pointer to the SWKey of the
> current module (this is ok), then expecting it to remain valid long
> enough for a call to SetKey to complete, on the same module.
>
> Here's the problem:  The process of setting a new key to a module
> involves deleting the current key.  At this point your new key is
> invalid, cuz it just got deleted.
>
> Does that make sense?

Yes, it does make sense. But shouldn't check SWModule::SetKey if it will 
delete it's own key? And why doesn't crash this with modules like BBE? If I'm 
right SWModule::SetKey is not reimplemented in another class.

I don't think this is the reason for all these crashes in BibleTime, I still 
can't find the reason for this, but I know it occurs only with the generic 
book support classes.

Thanks!
Joachim