diff options
author | Eike Ziller <[email protected]> | 2024-12-16 10:11:57 +0100 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2024-12-17 14:08:51 +0000 |
commit | 012dd52fa364ebdb8c177a057ffd3de8d34515c7 (patch) | |
tree | dba60b8ba23ff60fb861960a6a16ad27c174afd7 /src/libs/tracing/tracestashfile.h | |
parent | 8b6f7b4ea7060b29b1b07f2cc069401f64cbfabe (diff) |
QmlProfiler: Fix crash at startup if file creation fails
If opening the temporary file for QmlProfilerEventStorage fails in it's
destructor, it was crashing, because the error handler tried to emit a
signal on an object that wasn't even half constructed yet.
Can be tested by forcing the return value of TraceStashFile::open to
`false`.
Delay the construction of the event storage a bit and do not set the
error handler in its constructor, since nobody could connect to the
signal that was sent yet anyway. Also add some checks before calling the
error handler.
Change-Id: I0fc1207aac447090e12f6b2342e156312e0d1d1b
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/libs/tracing/tracestashfile.h')
-rw-r--r-- | src/libs/tracing/tracestashfile.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs/tracing/tracestashfile.h b/src/libs/tracing/tracestashfile.h index ebd3b514180..fac274e2c78 100644 --- a/src/libs/tracing/tracestashfile.h +++ b/src/libs/tracing/tracestashfile.h @@ -130,7 +130,8 @@ public: void clear() { - file.remove(); + if (!file.fileName().isEmpty()) + file.remove(); stream.setDevice(nullptr); } |