<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">You can reference a module's internal
key directly and use that reference to position a module just
fine, but you shouldn't hold on to the reference. A subsequent
call to a module's setKey method will often invalidate any
previous reference to the module's internal key.<br>
<br>
If you'd like to use a module's internal key instead of creating
your own, if possible gain the reference each time with
mod->getKey() (or as you have done with the (SWKey *) cast
operator). Or else be careful not to call mod->setKey, but I
would not recommend the latter.<br>
<br>
<br>
On 12/07/2014 06:27 PM, Karl Kleinpaste wrote:<br>
</div>
<blockquote cite="mid:5484FE82.1060606@kleinpaste.org" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<font face="FreeSerif">I asked Troy about this in IRC a bit
yesterday, but I ran into problems today and I'm in need of
clues.<br>
<br>
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:<br>
<br>
VerseKey *k = (VerseKey *)(SWKey *)(*mod);<br>
<br>
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:<br>
<br>
</font><font face="FreeSerif">VerseKey *k = (VerseKey
*)mod->createKey();<br>
<br>
and then calls to k->setTestament(1) work just fine. Of
course I have to remember to<br>
delete k;<br>
which is mildly annoying to have to do, and wasn't necessary
when using the module's own key.<br>
<br>
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?<br>
</font> <br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
<br>
<br>
</body>
</html>