From d270700c0ef42b6f1e1bef09bbf0bab59b3e78d1 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sat, 23 Mar 2024 11:55:37 +0100 Subject: 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 --- src/views/versioncontrol/updateitemstatesthread.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/views/versioncontrol/updateitemstatesthread.h') 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 +#include #include /** @@ -41,7 +42,7 @@ protected: private: QMutex *m_globalPluginMutex; // Protects the m_plugin globally - KVersionControlPlugin *m_plugin; + QPointer m_plugin; QMap> m_itemStates; }; -- cgit v1.3