[sword-devel] Pointer Management

Greg Hellings greg.hellings at gmail.com
Tue Mar 25 10:42:45 EDT 2025


I have a question about pointer lifetime and management when interacting
with libsword: who owns the lifetime and delete management of pointers
coming out of the SWMgr and SWModule calls? For instance: if I create an
SWMgr object and fetch a SWModule* from its get module methods, who owns
deletion of that? Should I preserve the pointer and have SWMgr delete it
when it gets deleted? Or does the caller need to own deletion of it? Is
that instance of the SWModule shared with everyone else who calls the
getter methods, or is it unique per invocation of the getter?

A similar question regarding getting keys from a module instance. Does that
key live with the module's cleanup, or does the caller now have
responsibility for the instance?

--Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20250325/65000635/attachment.htm>


More information about the sword-devel mailing list