Canvas: don't crash when getContext("2d") is called on destruction.
authorMitch Curtis <mitch.curtis@theqtcompany.com>
Mon, 26 Jan 2015 14:53:15 +0000 (15:53 +0100)
committerMitch Curtis <mitch.curtis@digia.com>
Mon, 26 Jan 2015 16:28:37 +0000 (17:28 +0100)
commit93affd9ff660456bde2d380788ea8ebfabb0f1c3
tree70482566d189e3627404145998be97205c11f467
parent15ffff51b5cc92eb875785bbd16b6385638fe5dd
Canvas: don't crash when getContext("2d") is called on destruction.

We'd assume that a Window existed when that's not always the case.
For example:

import QtQuick 2.4
import QtQuick.Window 2.2
Window {
    Loader {
        sourceComponent: Canvas {
            Component.onDestruction: getContext("2d")
        }
        Component.onCompleted: active = false
    }
}

Change-Id: I5f30876e21ced5658adfa3bac494fd4196e0a7e3
Task-number: QTBUG-42222
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
src/quick/items/context2d/qquickcanvasitem.cpp
tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml