summaryrefslogtreecommitdiffstats
path: root/src/corelib/tracing/qctf.cpp
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2023-03-20 08:17:52 +0200
committerJanne Koskinen <janne.p.koskinen@qt.io>2023-04-26 10:46:06 +0000
commitbb8aada627e23a7f7e23dfdb97d443f1b847086a (patch)
tree24f21a652528e03e6bbc20a44bba5e3ba3c634e1 /src/corelib/tracing/qctf.cpp
parent257b3161c5c5e46cd040371da77cb6a06987cf50 (diff)
Fix crash at exit when tracing
The crash is caused by the cleanup sending trace messages when the plugin has already been destroyed. Add shutdown callback to the plugin to indicate this has happened. We can't use signals since that also generetes trace event. Pick-to: 6.5 Change-Id: I2e490fc51c2aaa97c240c1496a528a6ff6077bd0 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Diffstat (limited to 'src/corelib/tracing/qctf.cpp')
-rw-r--r--src/corelib/tracing/qctf.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/corelib/tracing/qctf.cpp b/src/corelib/tracing/qctf.cpp
index 1dafa582d9..00a196c926 100644
--- a/src/corelib/tracing/qctf.cpp
+++ b/src/corelib/tracing/qctf.cpp
@@ -15,6 +15,7 @@ QT_BEGIN_NAMESPACE
static bool s_initialized = false;
static bool s_triedLoading = false;
static bool s_prevent_recursion = false;
+static bool s_shutdown = false;
static QCtfLib* s_plugin = nullptr;
#if defined(Q_OS_ANDROID)
@@ -59,18 +60,13 @@ static bool loadPlugin(bool &retry)
s_plugin = qobject_cast<QCtfLib *>(loader.instance());
if (!s_plugin)
return false;
- QObject *obj = loader.instance();
- if (obj) {
- QObject::connect(obj, &QObject::destroyed, []() {
- s_plugin = nullptr;
- });
- }
+ s_plugin->shutdown(&s_shutdown);
return true;
}
static bool initialize()
{
- if (s_prevent_recursion)
+ if (s_shutdown || s_prevent_recursion)
return false;
if (s_initialized || s_triedLoading)
return s_initialized;