summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-12-16 14:22:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-16 14:39:36 +0100
commite97191dd2184c587bb4c8e7ef5e50ffbace1d2f0 (patch)
tree4f7860d55a3f4d2a9d1eadb9e2f580441a1d0ffb
parenta9048cccf881504edcb4039160069dd870e1905d (diff)
Avoid errors when closing the application
This also fixes the crash on shutdown encountered when returning a TEXTURE_TRANSPORT GLSurfaceHandle from RenderWidgetHostViewQt::GetCompositingSurface. Change-Id: Ic92238907a3e7f9d0db4bf114269c1ca5cca5aa6 Reviewed-by: Arvid Nilsson <anilsson@blackberry.com> Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--src/core/web_engine_context.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 3f2bbc06d..7996f455b 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -69,6 +69,11 @@ namespace {
scoped_refptr<WebEngineContext> sContext;
+void destroyContext()
+{
+ sContext = 0;
+}
+
} // namespace
WebEngineContext::~WebEngineContext()
@@ -78,9 +83,11 @@ WebEngineContext::~WebEngineContext()
scoped_refptr<WebEngineContext> WebEngineContext::currentOrCreate(WebContentsAdapterClient::RenderingMode renderingMode)
{
- if (!sContext)
+ if (!sContext) {
sContext = new WebEngineContext(renderingMode);
- else if (renderingMode != sContext->renderingMode())
+ // Make sure that we ramp down Chromium before QApplication destroys its X connection, etc.
+ QObject::connect(qApp, &QCoreApplication::aboutToQuit, destroyContext);
+ } else if (renderingMode != sContext->renderingMode())
qFatal("Switching the QtWebEngine rendering mode once initialized in an application is not supported."
" If you're using both a QQuickWebView and a QtQuick WebEngineView, make sure that the"
" later is configured to use software rendering by setting:"