[sword-devel] VerseKey semantics

Karl Kleinpaste karl at kleinpaste.org
Sun Dec 7 18:27:30 MST 2014


I asked Troy about this in IRC a bit yesterday, but I ran into problems
today and I'm in need of clues.

In the av11n world, I've had to convert all VerseKey initialization to
be v11n-sensitive.  Mostly, I'd prefer just to use a module's own key
directly:

VerseKey *k = (VerseKey *)(SWKey *)(*mod);

The problem I've got is that there are a number of instances where
subsequent operations on k cause crashes or give exciting results.  For
one, when trying to fill a navbar book selector, the 2nd call to
k->setTestament(1) (populating OT books) segfaults.  Note, not the 1st
call, rather it's the 2nd, every time.  It's become necessary to create
the key the other way:

VerseKey *k = (VerseKey *)mod->createKey();

and then calls to k->setTestament(1) work just fine.  Of course I have
to remember to
delete k;
which is mildly annoying to have to do, and wasn't necessary when using
the module's own key.

Can anyone offer reasoning why the VerseKey from the module would have
trouble with this sort of use, and why an independently-created key from
the same module works fine?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20141207/bf756b2e/attachment.html>


More information about the sword-devel mailing list