[sword-devel] getRawEntry() invalidates key
Troy A. Griffitts
sword-devel@crosswire.org
Fri, 21 Jun 2002 01:56:51 -0700
Victor,
This should not be so. Could you show me code that does this? My
feeling is that you are grabbing a temporary key address created by the
module and holding on to it. This is not valid. The module may, at any
time delete and renew its internal key. You should not hold on to it's
address, but instead always get the key from the module every time you
need it.
The other alternative is to set a persistent key into the module:
VerseKey myKey;
myKey.Persist(1);
module.SetKey(&myKey);
Then the module will always use your external key. e.g. The following
code is valid to change the module position:
myKey = "John 1:1";
cout << module;
and you have your key to which you can keep a pointer.
Hope this helps,
-Troy.
Victor Porton wrote:
> Is it a bug or my misunderstanding? Please comment on this:
>
> After calling SWModule::getRawEntry() the module key is invalidated (the key
> text becomes empty string). Why? Should I just set the key again second time
> after getRawEntry() or the key can be "fixed" to not be invalidated by
> getRawEntry()?