Segfault when constructing QImage in PyQt6

Phil Thompson phil at riverbankcomputing.com
Fri Oct 15 11:41:35 BST 2021


On 15/10/2021 07:14, RoadrunnerWMC wrote:
> 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

I can reproduce this on Linux but it works on macOS. The core dump is 
within the Qt code so I suspect it's a Qt bug.

Phil
-------------- 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/5e92ddc1/attachment-0001.png>


More information about the PyQt mailing list