On Sunday, October 29, 2023 2:21:12 PM EDT Troy A. Griffitts wrote: > Hi David, > > On October 29, 2023 10:52:50 MST, "David "Judah's Shadow" Blue" <yudahssha...@gmx.com> wrote: > >The next class at play is the library class that also has a private member > >swordLibrary, > > > >sword::SWMgr swordLibrary; > > This is the issue. Since you are declaring an instance of SWMgr here, it > will get constructed in your library class c-tor with its own set of module > and filter, etc. objects. Then in setSwordLibrary you assign that fully > constructed local instance to a reference to the instance you newed > outside. > SWMgr is a factory object and assigning one factory to another doesn't > equate to a clear action. We could set option values from the source to the > destination, I suppose, but still that would give you what you want. I > would suggest changing this swordLibrary property of your library class to > a pointer. Then things should work as you expect.
That all makes senese. I've changed it to be a pointer in my interface class, so now it've got, my initialize method. void Interface::initalize() { configScreen(); std::cout << "Initializing SWORD, please wait..." << std::endl; this->swordLibrary = new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_PLAIN)); library.setSwordLibrary(swordLibrary); library.passage.setLibrary(*swordLibrary); library.lexicon.setSwordLibrary(*swordLibrary); std::cout << "Initialized, proceeding to shell..." << std::endl; } And in my Library class, I've got a private member sword::SWMgr *swordLibrary; void Library::setSwordLibrary(sword::SWMgr *library) { this->swordLibrary = library; } But I'm still getting a crash in the same spot once I try to get a module type, so I'm sure I've done something else wrong but am not sure what.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page