Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.9.0
-
None
Description
This is the same program, you can compile it with either Qt6 or Qt5 (I have 5.15.16 too) without any code-modification:
By just adjusting the cmakfile - revert/forward:
https://github.com/HinTak/skia-c-examples/commit/0d4c9a2a31963479c9c8bad9a65594e700773688
The Qt5 version works, but the Qt6 version crashes at the line:
canvas->drawImage(image, -50.0f, -50.0f);
This is a skia-based GL canvas drawing a Skia-based CPU-raster (on to a GL context provided by QT5/ QT6) .
The alternative "canvas->drawPath ...." is a pure GL rendering of the same functionality, and it works under both qt5 and qt6, and it is perhaps preferable in real usage, but the whole point of the example, is that it combine some CPU-based image (which could be an image loaded from disk, but in this case, drawn in CPU memory earlier) with GPU/GL-based drawing on a QT GL context.
I realize that I probably will need to debug this myself (as this uses current skia, and you need to build skia yourself), but would like some pointers / hints.
The repository is collection of skia-based demo in c/c++ ; it is a companion to https://github.com/HinTak/skia-python-examples
which is a collection of skia-python demos. I am one of the co-maintainers of skia-python.
The code came about from github copilot - I just asked it to port the SDL2 + skia python example to Qt5 and Qt6. the pyqt6 one crashes; I also asked it to port the c++ equivalent to qt6, but it works; then I compared to python port and c++ port, and found that the c++ port is not faithful, and did more - the c++ version completely rewrote the code and removed the skia CPU-based raster and rewrote it entirely in GL canvas operations. Anyway, the qt5 / pyqt5 version of this code works with canvas->drawImage, but the qt6 / pyqt6 version crash at that line.
If I simply comment out that line (on the python version) on pyqt6, the program does not crash, but spill out "Could not allocate vertices" in stderr.
Anyway, bottom line, same program (equivalent versions in c++/python), works under qt5 /pyqt5 , crash under qt6 / pyqt6 . It is a line where skia tries to draw an in-memory raster into a GL canvas, with a GL context provided by qt. The equivalent code works with sdl2 / sdl3 / glfw, gtk etc. I am making a collection of skia drawing to GL canvas in GL contexts provided by different GUI toolkit.