mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Do not store raw pointer to NameMapper.
While it was "ok" to store raw pointer as, in our use case, the nameMapper always live longer than object using it; it is not safe to store raw pointer on object than may be deleted. All classes storing a NameMapper now store a shared_ptr. Functions only using the library (as `HumanReadableNameMapper`) continue to use a (const) reference.
This commit is contained in:
@ -42,7 +42,7 @@ class OPDSDumper
|
||||
{
|
||||
public:
|
||||
OPDSDumper() = default;
|
||||
OPDSDumper(std::shared_ptr<Library> library, NameMapper* NameMapper);
|
||||
OPDSDumper(std::shared_ptr<Library> library, std::shared_ptr<NameMapper> NameMapper);
|
||||
~OPDSDumper();
|
||||
|
||||
/**
|
||||
@ -111,7 +111,7 @@ class OPDSDumper
|
||||
|
||||
protected:
|
||||
std::shared_ptr<kiwix::Library> library;
|
||||
kiwix::NameMapper* nameMapper;
|
||||
std::shared_ptr<kiwix::NameMapper> nameMapper;
|
||||
std::string libraryId;
|
||||
std::string rootLocation;
|
||||
int m_totalResults;
|
||||
|
Reference in New Issue
Block a user