mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 02:30:14 +02:00
Merge pull request #6844 from jherico/web_crash
Fix JS web window crash caused by race condition
This commit is contained in:
commit
8ffd30f89a
1 changed files with 9 additions and 13 deletions
|
@ -42,19 +42,15 @@ QmlWebWindowClass::QmlWebWindowClass(QObject* qmlWindow) : QmlWindowClass(qmlWin
|
||||||
void QmlWebWindowClass::handleNavigation(const QString& url) {
|
void QmlWebWindowClass::handleNavigation(const QString& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlWebWindowClass::getURL() const {
|
QString QmlWebWindowClass::getURL() const {
|
||||||
if (QThread::currentThread() != thread()) {
|
QVariant result = DependencyManager::get<OffscreenUi>()->returnFromUiThread([&]()->QVariant {
|
||||||
QString result;
|
return _qmlWindow->property(URL_PROPERTY);
|
||||||
QMetaObject::invokeMethod(const_cast<QmlWebWindowClass*>(this), "getURL", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, result));
|
});
|
||||||
return result;
|
return result.toString();
|
||||||
}
|
|
||||||
|
|
||||||
return _qmlWindow->property(URL_PROPERTY).toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlWebWindowClass::setURL(const QString& urlString) {
|
void QmlWebWindowClass::setURL(const QString& urlString) {
|
||||||
if (QThread::currentThread() != thread()) {
|
DependencyManager::get<OffscreenUi>()->executeOnUiThread([=] {
|
||||||
QMetaObject::invokeMethod(this, "setURL", Qt::QueuedConnection, Q_ARG(QString, urlString));
|
_qmlWindow->setProperty(URL_PROPERTY, urlString);
|
||||||
}
|
});
|
||||||
_qmlWindow->setProperty(URL_PROPERTY, urlString);
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue