From ac59e18a83b2ca524d03c937bd7ed7cbcfa3393a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 4 Jan 2016 18:12:39 +0100 Subject: Material: declare dependency on QtGraphicalEffects Change-Id: I5c79641b2f4e4eb39acc8d102e7d9494f71a9dd1 Reviewed-by: Mitch Curtis --- src/imports/controls/material/qmldir | 1 + 1 file changed, 1 insertion(+) (limited to 'src/imports/controls/material') diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir index 19f71b4a..d90e75d8 100644 --- a/src/imports/controls/material/qmldir +++ b/src/imports/controls/material/qmldir @@ -2,3 +2,4 @@ module Qt.labs.controls.material plugin qtlabsmaterialstyleplugin classname QtLabsMaterialStylePlugin depends Qt.labs.controls 1.0 +depends QtGraphicalEffects 1.0 -- cgit v1.2.3 From 3456b4eb249d49239ec3cf822db950b8e20bb789 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 5 Jan 2016 10:19:19 +0100 Subject: Busy animators: fix access to childContainerNode() Accessing QQuickItemPrivate::childContainerNode() in updateCurrentTime(), which is executed in render thread context, is not safe and may cause random crashes. Change-Id: Ibbdf387f7e8d593740452e56b819a6d7fd9341e6 Reviewed-by: Mitch Curtis --- .../controls/material/qquickmaterialprogressring.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/imports/controls/material') diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index 7f7ed114..54728686 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -71,9 +71,10 @@ public: void updateCurrentTime(int time) Q_DECL_OVERRIDE; void writeBack() Q_DECL_OVERRIDE; void nodeWasDestroyed() Q_DECL_OVERRIDE; + void afterNodeSync() Q_DECL_OVERRIDE; private: - QSGNode *m_itemNode; + QSGNode *m_containerNode; QQuickWindow *m_window; }; @@ -164,7 +165,7 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const } QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() : - m_itemNode(Q_NULLPTR), + m_containerNode(Q_NULLPTR), m_window(Q_NULLPTR) { } @@ -176,14 +177,16 @@ QQuickMaterialRingAnimatorJob::~QQuickMaterialRingAnimatorJob() void QQuickMaterialRingAnimatorJob::initialize(QQuickAnimatorController *controller) { QQuickAnimatorJob::initialize(controller); - m_itemNode = QQuickItemPrivate::get(m_target)->itemNode(); + m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); m_window = m_target->window(); } void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) { - QSGNode *childContainerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); - QSGSimpleRectNode *rectNode = static_cast(childContainerNode->firstChild()); + if (!m_containerNode) + return; + + QSGSimpleRectNode *rectNode = static_cast(m_containerNode->firstChild()); if (!rectNode) return; @@ -252,10 +255,15 @@ void QQuickMaterialRingAnimatorJob::writeBack() void QQuickMaterialRingAnimatorJob::nodeWasDestroyed() { - m_itemNode = Q_NULLPTR; + m_containerNode = Q_NULLPTR; m_window = Q_NULLPTR; } +void QQuickMaterialRingAnimatorJob::afterNodeSync() +{ + m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); +} + QQuickMaterialRingTexture::QQuickMaterialRingTexture() { } -- cgit v1.2.3