Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/common/fileloadthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ void FileLoadThread::run()

file.close();
emit sigLoadFinished(encode, indata, true, false);
// Skip the common cleanup at the end of run(): stop the event loop
// and release the thread object, or both leak on the error path.
this->quit();
this->deleteLater();
Comment on lines +90 to +91

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): deleteLater() queues destruction of the FileLoadThread object in its owning thread, which is normally the GUI thread, before the worker thread has necessarily finished returning from run(). If that event is processed during this window, the QThread object is destroyed while still running and Qt reports QThread: Destroyed while thread is still running (and can abort).

Triggers: When the owning thread processes the deferred-delete event before the worker thread has completed its return from run().

Suggested fix: Schedule deletion from the thread's finished signal and rely on that signal for cleanup after the worker has actually terminated.

return;
}

Expand Down
Loading