Re: [sword-devel] Pointer Management

2025-04-17 Thread Troy A. Griffitts
Yes, exactly.  SWModule is stateful: e.g., you can turn options on and off, set properties, and position it to a verse and it retains that information, e.g, mod->setKey("Jn.3.16"); cout << mod->renderText(); // renders Jn.3.16 So, if I am using one SWModule instance for reading and display and

Re: [sword-devel] Pointer Management

2025-04-11 Thread Greg Hellings
OK, so if I have code like this: SWModule *mod1 = mgr->getModule("KJV"); SWModule *mod2 = mgr->getModule("KJV"); Those two pointers are to an object owned by the SWMgr object and I should simply let the variable go out of scope when I'm done with it? I should not be calling any delete or free on

Re: [sword-devel] Pointer Management

2025-04-05 Thread Troy A. Griffitts
Hi Greg, Typically in SWORD, the object/factory that created the object is responsible for deleting the object unless a call was made to something like 'clone' or 'create'.  So, SWMgr will delete all the SWModule objects it allowcates when the SWMgr object is deleted. If you have multiple thr

[sword-devel] Pointer Management

2025-03-25 Thread Greg Hellings
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