vlc | branch: master | Romain Vimont <[email protected]> | Tue Nov 17 15:30:19 2020 +0100| [2e44710d0e3e344046e1a64142968d4b8e53da06] | committer: Pierre Lamot
qt: medialib: pass loader via a raw pointer Currently, the loader is owned by MLModelCache, but in the future it might outlive it: database queries will be executed from a separate thread, and MLModelCache could be deleted while an asynchronous request is running. To prepare for this change, do not require to receive the loader via a std::unique_ptr (let the cache wrap it). Signed-off-by: Pierre Lamot <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2e44710d0e3e344046e1a64142968d4b8e53da06 --- modules/gui/qt/medialibrary/mlbasemodel.hpp | 4 ++-- modules/gui/qt/util/listcache.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp b/modules/gui/qt/medialibrary/mlbasemodel.hpp index fbf357c64e..70e1524c20 100644 --- a/modules/gui/qt/medialibrary/mlbasemodel.hpp +++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp @@ -217,8 +217,8 @@ protected: if (m_cache) return; - auto loader = std::make_unique<Loader>(*this); - m_cache.reset(new ListCache<std::unique_ptr<T>>(std::move(loader))); + auto loader = new Loader(*this); + m_cache.reset(new ListCache<std::unique_ptr<T>>(loader)); connect(&*m_cache, &BaseListCache::localDataChanged, this, &MLSlidingWindowModel<T>::onLocalDataChanged); diff --git a/modules/gui/qt/util/listcache.hpp b/modules/gui/qt/util/listcache.hpp index d7d423da81..c762e84ede 100644 --- a/modules/gui/qt/util/listcache.hpp +++ b/modules/gui/qt/util/listcache.hpp @@ -75,8 +75,8 @@ class ListCache : public BaseListCache public: static constexpr ssize_t COUNT_UNINITIALIZED = -1; - ListCache(std::unique_ptr<ListCacheLoader<T>> loader, size_t chunkSize = 100) - : m_loader(std::move(loader)) + ListCache(ListCacheLoader<T> *loader, size_t chunkSize = 100) + : m_loader(loader) , m_chunkSize(chunkSize) {} /** _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
