That's such a weird bug, if it's even a bug.
This works:
from PySide6.QtCore import QBuffer, QByteArray, QFile, QIODevice
from PySide6.QtGui import QImageReader
image_path = Path('/home/p10/testIAMAGAGADS.png')
file = QFile(image_path)
file.open(QIODevice.ReadOnly)
blob = file.readAll()
buffer = QBuffer(blob)
image_reader = QImageReader(buffer)
This crashes PySide6:
from pathlib import Path
from PySide6.QtCore import QBuffer, QByteArray, QFile, QIODevice
from PySide6.QtGui import QImageReader
image_path = Path('/home/p10/testIAMAGAGADS.png')
file = QFile(image_path)
file.open(QIODevice.ReadOnly)
blob = file.readAll()
image_reader = QImageReader(QBuffer(blob))
I would expect an object created in a specific scope (albeit passed as an argument) to stay alive at least till the end of that scope. PS: The same thing happens when I read the image from a file to a bytes object and pass it to QBuffer without binding it to a variable beforehand.