mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Make Downloader
return shared_ptr instead of raw pointer.
This is dangerous by nature to return raw pointer on internal data.
This commit is contained in:
@ -93,15 +93,15 @@ class Downloader
|
||||
|
||||
void close();
|
||||
|
||||
Download* startDownload(const std::string& uri, const std::vector<std::pair<std::string, std::string>>& options = {});
|
||||
Download* getDownload(const std::string& did);
|
||||
std::shared_ptr<Download> startDownload(const std::string& uri, const std::vector<std::pair<std::string, std::string>>& options = {});
|
||||
std::shared_ptr<Download> getDownload(const std::string& did);
|
||||
|
||||
size_t getNbDownload();
|
||||
std::vector<std::string> getDownloadIds();
|
||||
|
||||
private:
|
||||
std::mutex m_lock;
|
||||
std::map<std::string, std::unique_ptr<Download>> m_knownDownloads;
|
||||
std::map<std::string, std::shared_ptr<Download>> m_knownDownloads;
|
||||
std::shared_ptr<Aria2> mp_aria;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user