From 0b6b67ca073dd778d7ad803dab1fa2bcae4a8c8a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 25 Feb 2014 17:08:26 +0100 Subject: [PATCH] QmlProfiler: Don't use the canvas context if it isn't ready The documentation indicates that onPaint can actually be called while the context isn't ready. Change-Id: I32d861e016e5e990f3d940a35ec28956902041ba Reviewed-by: Kai Koehne --- src/plugins/qmlprofiler/qml/Overview.qml | 2 ++ src/plugins/qmlprofiler/qml/TimeDisplay.qml | 2 ++ src/plugins/qmlprofiler/qml/TimeMarks.qml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml index 9fed5a9c37c..40869602525 100644 --- a/src/plugins/qmlprofiler/qml/Overview.qml +++ b/src/plugins/qmlprofiler/qml/Overview.qml @@ -92,6 +92,8 @@ Canvas { // ***** slots onPaint: { + if (context === null) + return; // canvas isn't ready Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy; if (dataReady) { Plotter.plot(canvas, context, region); diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml index 107a5678d9e..12cecf435f1 100644 --- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml +++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml @@ -49,6 +49,8 @@ Canvas { } onPaint: { + if (context === null) + return; // canvas isn't ready context.fillStyle = "white"; context.fillRect(0, 0, width, height); diff --git a/src/plugins/qmlprofiler/qml/TimeMarks.qml b/src/plugins/qmlprofiler/qml/TimeMarks.qml index 6bf6be330cd..f9ac8e3590e 100644 --- a/src/plugins/qmlprofiler/qml/TimeMarks.qml +++ b/src/plugins/qmlprofiler/qml/TimeMarks.qml @@ -47,6 +47,8 @@ Canvas { onYChanged: requestPaint() onPaint: { + if (context === null) + return; // canvas isn't ready drawBackgroundBars( context, region ); var totalTime = endTime - startTime;