trying to fix web surfaces??

This commit is contained in:
SamGondelman 2019-01-28 18:29:09 -08:00
parent 0d1e4bed66
commit 7b88efa42c
4 changed files with 11 additions and 16 deletions

View file

@ -2332,7 +2332,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Fix for crash in QtWebEngineCore when rapidly switching domains
// Call stop on the QWebEngineView before destroying OffscreenQMLSurface.
if (rootItem) {
if (rootItem && !cachedWebSurface) {
// stop loading
QMetaObject::invokeMethod(rootItem, "stop");
}

View file

@ -189,13 +189,13 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
});
if (urlChanged) {
if (!_loading && (newContentType != ContentType::HtmlContent || currentContentType != ContentType::HtmlContent)) {
destroyWebSurface();
}
withWriteLock([&] {
_contentType = newContentType;
});
if (newContentType != ContentType::HtmlContent || currentContentType != ContentType::HtmlContent) {
destroyWebSurface();
}
}
}
@ -214,10 +214,12 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
// This work must be done on the main thread
if (!_webSurface) {
buildWebSurface(entity, newSourceURL);
_loading = true;
}
if (_webSurface && _webSurface->getRootItem()) {
if (_webSurface) {
if (_webSurface->getRootItem()) {
_loading = false;
if (_contentType == ContentType::HtmlContent && urlChanged) {
_webSurface->getRootItem()->setProperty(URL_PROPERTY, newSourceURL);
_sourceURL = newSourceURL;

View file

@ -77,6 +77,7 @@ private:
};
static ContentType getContentType(const QString& urlString);
ContentType _contentType { ContentType::NoContent };
bool _loading { false };
QSharedPointer<OffscreenQmlSurface> _webSurface { nullptr };
bool _cachedWebSurface { false };

View file

@ -232,15 +232,7 @@ float WebEntityItem::getAlpha() const {
void WebEntityItem::setSourceUrl(const QString& value) {
withWriteLock([&] {
if (_sourceUrl != value) {
auto newURL = QUrl::fromUserInput(value);
if (newURL.isValid()) {
_sourceUrl = newURL.toDisplayString();
} else {
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
}
}
_sourceUrl = value;
});
}
@ -270,7 +262,7 @@ void WebEntityItem::setScriptURL(const QString& value) {
if (newURL.isValid()) {
_scriptURL = newURL.toDisplayString();
} else {
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
qCDebug(entities) << "Not setting web entity script URL since" << value << "cannot be parsed to a valid URL.";
}
}
});