Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.4.0
-
c2706491906c053f5d38ddc0558a993bbf7cfd3e
Description
The following piece of QML work fine with Qt 5.3. The canvas item is blue and becomes blue again when the window is hidden and shown. When I use the same QML with the current state of Qt 5.4 the canvas is cleared on hiding and even cannot be painted to anymore when the window is shown again. It seems the context gets silently destroyed and isn't recreated later.
import QtQuick 2.2 import QtQuick.Window 2.1 Window { id: root visible: true width: 360 height: 360 Timer { repeat: true interval: 2000 running: true onTriggered: { if (!root.visible) { root.show(); //canvas.requestPaint(); <- triggers the "context dead" message on 5.4 but otherwise makes no difference } else { root.hide(); } } } Canvas { id: canvas anchors.fill: parent contextType: "2d" onPaint: { if (context === null) { console.log("context is dead"); return; // canvas isn't ready } context.reset(); context.fillStyle = "blue"; context.fillRect(0, 0, width, height); } } }