[vlc-commits] [Git][videolan/vlc][master] qt: fix calling unavailable pure virtual method in `LocalListCacheLoader`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 3 05:17:30 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
46d53f7c by Fatih Uzunoglu at 2025-10-03T04:53:12+00:00
qt: fix calling unavailable pure virtual method in `LocalListCacheLoader`
This fixes the crash occurring when switching pages.
- - - - -
1 changed file:
- modules/gui/qt/util/locallistcacheloader.hpp
Changes:
=====================================
modules/gui/qt/util/locallistcacheloader.hpp
=====================================
@@ -74,12 +74,22 @@ public:
class ModelSource
{
public:
- virtual ~ModelSource() = default;
+ virtual ~ModelSource()
+ {
+ // At this point, pure virtual methods are not available.
+ m_isDying = true;
+ }
+
//the revision must be incremented each time the model changes
virtual size_t getModelRevision() const = 0;
//return the data matching the pattern
virtual std::vector<ItemType> getModelData(const QString& pattern) const = 0;
+
+ bool isDying() const { return m_isDying; }
+
+ private:
+ bool m_isDying = false;
};
public:
@@ -102,7 +112,8 @@ public:
size_t countTask(std::function<void(size_t taskId, size_t count)> cb) override
{
return runTaskAsync([this, cb](size_t taskId) {
- updateData();
+ if (!updateData())
+ return;
cb(taskId, m_items.size());
});
}
@@ -112,7 +123,8 @@ public:
std::function<void(size_t taskId, std::vector<ItemType>& data)> cb) override
{
return runTaskAsync([this, offset, limit, cb](size_t taskId) {
- updateData();
+ if (!updateData())
+ return;
std::vector<ItemType> data;
if (offset < m_items.size())
{
@@ -135,7 +147,8 @@ public:
std::function<void(size_t taskId, size_t count, std::vector<ItemType>& data)> cb) override
{
return runTaskAsync([this, offset, limit, cb](size_t taskId) {
- updateData();
+ if (!updateData())
+ return;
std::vector<ItemType> data;
if (offset < m_items.size())
{
@@ -153,15 +166,20 @@ public:
});
}
- void updateData()
+ bool updateData()
{
+ if (m_source->isDying())
+ return false;
+
if (m_revision == m_source->getModelRevision())
- return;
+ return true;
m_items = m_source->getModelData(m_pattern);
std::sort(m_items.begin(), m_items.end(), m_compare);
m_revision = m_source->getModelRevision();
+
+ return true;
}
const ModelSource* m_source;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/46d53f7c1b04e42762ec79dd35eae7e69d35c9bc
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/46d53f7c1b04e42762ec79dd35eae7e69d35c9bc
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list