Segfault when constructing QImage in PyQt6

RoadrunnerWMC roadrunnerwmc at gmail.com
Fri Oct 15 07:14:57 BST 2021


Hi Phil,

I believe I found a bug in PyQt6. Test case is very simple:

from PyQt6 import QtCore, QtGui, QtWidgets

app = QtWidgets.QApplication([])

img = QtGui.QImage(b'\xff' * (256 * 256 * 4), 256, 256,
> QtGui.QImage.Format.Format_ARGB32)

img.save('test.png')


In PyQt5 5.15.4 (adjust the import line to test it), this correctly saves a
white 256x256 png in the current directory.
In PyQt6 6.2.0 on Ubuntu 20.04, this segfaults on the last line.
In PyQt6 6.2.0 on Windows 10, it doesn't crash, but the output is a corrupt
image (example attached). I can also make it sometimes do the same on
Ubuntu by playing with the QImage constructor arguments.

Let me know if you need any more info.

Thanks,
RoadrunnerWMC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211015/55524602/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_win.png
Type: image/png
Size: 61333 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211015/55524602/attachment-0001.png>


More information about the PyQt mailing list