[Development] Should null QPixmaps be allowed in a QCoreApplication?
Sze Howe Koh
szehowe.koh at gmail.com
Tue Jul 27 18:41:01 CEST 2021
Current Qt behaviours:
A) If you create any QPixmap after creating QGuiApplication, the result is
probably the pixmap that you asked for. All is well.
B) If you create any QPixmap after creating QCoreApplication, the result is
a null QPixmap. No warnings are produced.
C) If you create any QPixmap _in a secondary thread_ after creating
QCoreApplication, the result is a segfault due to a nullptr dereference [1].
D) If you create any QPixmap without creating Q(Core|Gui|)Application, the
result is a qFatal() telling you that you must have a QGuiApplication.
I think that results of (B) and (C) should be changed to match (D) [2].
However, there are some complications:
* There is a unit test that relies on the current behaviour of (B) [3].
* Making this change will break existing user code that relies on the
current behaviour of (B).
How should we proceed?
Regards,
Sze-Howe
[1] https://bugreports.qt.io/browse/QTBUG-95358
[2] https://codereview.qt-project.org/c/qt/qtbase/+/3618911
[3]
https://code.qt.io/cgit/qt/qtbase.git/tree/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210728/c1f7a84b/attachment.html>
More information about the Development
mailing list