[sword-devel] BUG in general book support

Troy A. Griffitts sword-devel@crosswire.org
Wed, 27 Feb 2002 10:38:19 -0700

	Point well taken.  I've rearranged things in SetKey to allow this
scenerio. Your test now works without segfaulting.  Let me know if it
helps things in Bibletime.


Joachim Ansorg wrote:
> 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