d->rc->initialize(gl);
}
-void QQuickRenderControl::invalidate()
-{
- Q_D(QQuickRenderControl);
- d->rc->invalidate();
-}
-
/*!
This function should be called as late as possible before
sync(). In a threaded scenario, rendering can happen in parallel with this function.
Stop rendering and release resources. This function is typically
called when the window is hidden. Requires a current context.
*/
-void QQuickRenderControl::stop()
+void QQuickRenderControl::invalidate()
{
Q_D(QQuickRenderControl);
if (!d->window)
cd->fireAboutToStop();
cd->cleanupNodesOnShutdown();
- if (!cd->persistentSceneGraph) {
- d->rc->invalidate();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- }
+ // We must invalidate since the context can potentially be destroyed by the
+ // application right after returning from this function. Invalidating is
+ // also essential to allow a subsequent initialize() to succeed.
+ d->rc->invalidate();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
/*!
QObject::connect(renderControl, SIGNAL(sceneChanged()), q, SLOT(triggerUpdate()));
}
-void QQuickWidgetPrivate::stopRenderControl()
+void QQuickWidgetPrivate::invalidateRenderControl()
{
if (!context) // this is not an error, could be called before creating the context, or multiple times
return;
bool success = context->makeCurrent(offscreenSurface);
if (!success) {
- qWarning("QQuickWidget::stopRenderControl could not make context current");
+ qWarning("QQuickWidget::invalidateRenderControl could not make context current");
return;
}
- renderControl->stop();
+ renderControl->invalidate();
}
void QQuickWidgetPrivate::handleWindowChange()
{
- stopRenderControl();
+ invalidateRenderControl();
destroyContext();
}
if (QQmlDebugService::isDebuggingEnabled())
QQmlInspectorService::instance()->removeView(q_func());
- stopRenderControl();
+ invalidateRenderControl();
// context and offscreenSurface are current at this stage, if the context was created.
Q_ASSERT(!context || (QOpenGLContext::currentContext() == context && context->surface() == offscreenSurface));
void QQuickWidget::hideEvent(QHideEvent *)
{
Q_D(QQuickWidget);
- d->stopRenderControl();
+ d->invalidateRenderControl();
}
/*! \reimp */
void init(QQmlEngine* e = 0);
void handleWindowChange();
- void stopRenderControl();
+ void invalidateRenderControl();
QSize rootObjectSize() const;