┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/versioncontrol/updateitemstatesthread.h
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2024-03-23 11:55:37 +0100
committerMéven Car <[email protected]>2024-03-24 11:55:54 +0100
commitd270700c0ef42b6f1e1bef09bbf0bab59b3e78d1 (patch)
tree9e3949119321c9e99e602c0b97f77290a648789a /src/views/versioncontrol/updateitemstatesthread.h
parent5795d57dcb601b154a8856df56c2fcab02b6b0f4 (diff)
versioncontrol: Prevent a use-after-free in UpdateItemStatesThread
UpdateItemStatesThread kept a pointer reference to m_plugin whose lifetime was tied to VersionControlObserver parents. On application shutdown it could happen the thread is still running when the Observer is destroyed. Make the plugin pointer a weak reference, allowing to stop the thread when the plugin is gone. BUG: 477425
Diffstat (limited to 'src/views/versioncontrol/updateitemstatesthread.h')
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h
index 24f060d26..550436010 100644
--- a/src/views/versioncontrol/updateitemstatesthread.h
+++ b/src/views/versioncontrol/updateitemstatesthread.h
@@ -11,6 +11,7 @@
#include "views/versioncontrol/versioncontrolobserver.h"
#include <QMutex>
+#include <QPointer>
#include <QThread>
/**
@@ -41,7 +42,7 @@ protected:
private:
QMutex *m_globalPluginMutex; // Protects the m_plugin globally
- KVersionControlPlugin *m_plugin;
+ QPointer<KVersionControlPlugin> m_plugin;
QMap<QString, QVector<VersionControlObserver::ItemState>> m_itemStates;
};