From 63fa54ceda12a29fb799cd2d35e9c44959069bd3 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 18 Jul 2018 14:54:19 -0700 Subject: [PATCH] Fix for audio continuing on destroyed Web 3D overlays --- interface/src/ui/overlays/Web3DOverlay.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index a8a82c74b7..fbea492d1d 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -138,11 +138,8 @@ void Web3DOverlay::destroyWebSurface() { // Fix for crash in QtWebEngineCore when rapidly switching domains // Call stop on the QWebEngineView before destroying OffscreenQMLSurface. if (rootItem) { - QObject* obj = rootItem->findChild("webEngineView"); - if (obj) { - // stop loading - QMetaObject::invokeMethod(obj, "stop"); - } + // stop loading + QMetaObject::invokeMethod(rootItem, "stop"); } _webSurface->pause(); @@ -152,6 +149,11 @@ void Web3DOverlay::destroyWebSurface() { // If the web surface was fetched out of the cache, release it back into the cache if (_cachedWebSurface) { + // If it's going back into the cache make sure to explicitly set the URL to a blank page + // in order to stop any resource consumption or audio related to the page. + if (rootItem) { + rootItem->setProperty("url", "about:blank"); + } auto offscreenCache = DependencyManager::get(); // FIXME prevents crash on shutdown, but we shoudln't have to do this check if (offscreenCache) {