forked from qt-creator/qt-creator
FileStreamWriter: Add some comments into d'tor
When d'tor of the parent Async<void> runs, it busy waits for the WriteBuffer's thread to finish, and afterwards QObject's d'tor deletes the child WriteBuffer object. Change-Id: Ifc696b3e56735e697d8c54c2471f89e323d3c0d1 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -223,6 +223,11 @@ public:
|
||||
~FileStreamWriter() { // TODO: should d'tor remove unfinished file write leftovers?
|
||||
if (m_writeBuffer && isBuffered())
|
||||
m_writeBuffer->cancel();
|
||||
// m_writeBuffer is a child of either Process or Async<void>. So, if m_writeBuffer
|
||||
// is still alive now (in case when TaskTree::stop() was called), the FileStreamBase
|
||||
// d'tor is going to delete m_writeBuffer later. In case of Async<void>, coming from
|
||||
// localTask(), the d'tor of Async<void>, run by FileStreamBase, busy waits for the
|
||||
// already canceled here WriteBuffer to finish before deleting WriteBuffer child.
|
||||
}
|
||||
|
||||
void setWriteData(const QByteArray &writeData) {
|
||||
|
Reference in New Issue
Block a user