Make the Server keep a shared_ptr instead of a raw NameMapper pointer.

Same as for `Library`, we want to be sure that the `NameMapper`
actually exists when the server is using it.
This commit is contained in:
Matthieu Gautier
2023-09-25 16:44:28 +02:00
parent a5557eeb25
commit 1316dec37c
6 changed files with 21 additions and 16 deletions

View File

@ -36,7 +36,7 @@ namespace kiwix
*
* @param library The library to serve.
*/
Server(std::shared_ptr<Library> library, NameMapper* nameMapper=nullptr);
Server(std::shared_ptr<Library> library, std::shared_ptr<NameMapper> nameMapper=nullptr);
virtual ~Server();
@ -67,7 +67,7 @@ namespace kiwix
protected:
std::shared_ptr<Library> mp_library;
NameMapper* mp_nameMapper;
std::shared_ptr<NameMapper> mp_nameMapper;
std::string m_root = "";
std::string m_addr = "";
std::string m_indexTemplateString = "";