Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15.11, 6.4.0
-
None
-
-
f645125b0 (dev), b0f384ca7 (6.4), b2f8190d4 (tqtc/lts-5.15), 4d8246c7b (6.5)
-
DaVinci 70
Description
Trying to `make docs` resulted in QtAttributionsScanner crashing frequently with e.g.:
/usr/local/Trolltech/Qt-5.15.11-universal/bin/qtattributionsscanner ./Qt-5.15.11_build/qtbase --filter QDocModule=qtcore -o ./Qt-5.15.11_build/qtbase/src/corelib/codeattributions.qdoc libc++abi: Pure virtual function called! Abort trap: 6
Other times it wouldn't crash and just show a "QIODevice::write: ReadOnly device" or "QIODevice::write: device not open" debug output.
It seems like the destruction order of a QTextStream operating on a QFile is wrong. As the QFile is declared after the QTextStream, the QFile is destroyed first before the QTextStream is destroyed and tries to flush the (previously closed and destroyed) QFile in its destructor (see https://codereview.qt-project.org/gitweb?p=qt/qttools.git;a=blob;f=src/qtattributionsscanner/main.cpp;h=79cb67f55b3cad3b1a809a4c98666f6531e3daf1;hb=HEAD#l132).
The attached patch fixes the issue.
I encountered the issues with Qt 5.15.11 building on macOS Monterey with XCode 13.4.1 (SDK 12.3), but I think this affects all Qt versions and all platforms.
Attachments
For Gerrit Dashboard: QTBUG-109618 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
450718,2 | qtattributionsscanner: Fix QTextStream/QFile construction order | dev | qt/qttools | Status: MERGED | +2 | 0 |
451290,2 | qtattributionsscanner: Fix QTextStream/QFile construction order | 6.5 | qt/qttools | Status: MERGED | +2 | 0 |
451291,2 | qtattributionsscanner: Fix QTextStream/QFile construction order | 6.4 | qt/qttools | Status: MERGED | +2 | 0 |
451331,2 | qtattributionsscanner: Fix QTextStream/QFile construction order | tqtc/lts-5.15 | qt/tqtc-qttools | Status: MERGED | +2 | 0 |