mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge pull request #15933 from danteruiz/fix-interactive-deadlock
BUGZ-1014: Crash when opening Create
This commit is contained in:
commit
117577cd29
2 changed files with 12 additions and 23 deletions
|
@ -132,7 +132,6 @@ InteractiveWindowPointer DesktopScriptingInterface::createWindow(const QString&
|
||||||
}
|
}
|
||||||
|
|
||||||
InteractiveWindowPointer DesktopScriptingInterface::createWindowOnThread(const QString& sourceUrl, const QVariantMap& properties, QThread* targetThread) {
|
InteractiveWindowPointer DesktopScriptingInterface::createWindowOnThread(const QString& sourceUrl, const QVariantMap& properties, QThread* targetThread) {
|
||||||
|
|
||||||
// The offscreen surface already validates against non-local QML sources, but we also need to ensure that
|
// The offscreen surface already validates against non-local QML sources, but we also need to ensure that
|
||||||
// if we create top level QML, like dock widgets or other types of QQuickView containing desktop windows
|
// if we create top level QML, like dock widgets or other types of QQuickView containing desktop windows
|
||||||
// that the source URL is permitted
|
// that the source URL is permitted
|
||||||
|
|
|
@ -293,7 +293,11 @@ void InteractiveWindow::close() {
|
||||||
|
|
||||||
if (_dockWidget) {
|
if (_dockWidget) {
|
||||||
auto window = qApp->getWindow();
|
auto window = qApp->getWindow();
|
||||||
BLOCKING_INVOKE_METHOD(window, "removeDockWidget", Q_ARG(QDockWidget*, _dockWidget.get()));
|
if (QThread::currentThread() != window->thread()) {
|
||||||
|
BLOCKING_INVOKE_METHOD(window, "removeDockWidget", Q_ARG(QDockWidget*, _dockWidget.get()));
|
||||||
|
} else {
|
||||||
|
window->removeDockWidget(_dockWidget.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_dockWidget = nullptr;
|
_dockWidget = nullptr;
|
||||||
_qmlWindowProxy = nullptr;
|
_qmlWindowProxy = nullptr;
|
||||||
|
@ -332,10 +336,8 @@ bool InteractiveWindow::isVisible() const {
|
||||||
if (!_qmlWindowProxy) {
|
if (!_qmlWindowProxy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QVariant result;
|
|
||||||
BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result),
|
return _qmlWindowProxy->readProperty(INTERACTIVE_WINDOW_VISIBLE_PROPERTY).toBool();
|
||||||
Q_ARG(QString, INTERACTIVE_WINDOW_VISIBLE_PROPERTY));
|
|
||||||
return result.toBool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 InteractiveWindow::getPosition() const {
|
glm::vec2 InteractiveWindow::getPosition() const {
|
||||||
|
@ -343,11 +345,7 @@ glm::vec2 InteractiveWindow::getPosition() const {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant result;
|
return toGlm(_qmlWindowProxy->readProperty(INTERACTIVE_WINDOW_POSITION_PROPERTY).toPointF());
|
||||||
BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result),
|
|
||||||
Q_ARG(QString, INTERACTIVE_WINDOW_POSITION_PROPERTY));
|
|
||||||
|
|
||||||
return toGlm(result.toPointF());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveWindow::setPosition(const glm::vec2& position) {
|
void InteractiveWindow::setPosition(const glm::vec2& position) {
|
||||||
|
@ -363,10 +361,7 @@ glm::vec2 InteractiveWindow::getSize() const {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant result;
|
return toGlm(_qmlWindowProxy->readProperty(INTERACTIVE_WINDOW_SIZE_PROPERTY).toSize());
|
||||||
BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result),
|
|
||||||
Q_ARG(QString, INTERACTIVE_WINDOW_SIZE_PROPERTY));
|
|
||||||
return toGlm(result.toSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveWindow::setSize(const glm::vec2& size) {
|
void InteractiveWindow::setSize(const glm::vec2& size) {
|
||||||
|
@ -382,10 +377,7 @@ QString InteractiveWindow::getTitle() const {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant result;
|
return _qmlWindowProxy->readProperty(TITLE_PROPERTY).toString();
|
||||||
BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result),
|
|
||||||
Q_ARG(QString, TITLE_PROPERTY));
|
|
||||||
return result.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveWindow::setTitle(const QString& title) {
|
void InteractiveWindow::setTitle(const QString& title) {
|
||||||
|
@ -399,10 +391,8 @@ int InteractiveWindow::getPresentationMode() const {
|
||||||
if (!_qmlWindowProxy) {
|
if (!_qmlWindowProxy) {
|
||||||
return Virtual;
|
return Virtual;
|
||||||
}
|
}
|
||||||
QVariant result;
|
|
||||||
BLOCKING_INVOKE_METHOD(_qmlWindowProxy.get(), "readProperty", Q_RETURN_ARG(QVariant, result),
|
return _qmlWindowProxy->readProperty(PRESENTATION_MODE_PROPERTY).toInt();
|
||||||
Q_ARG(QString, PRESENTATION_MODE_PROPERTY));
|
|
||||||
return result.toInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveWindow::parentNativeWindowToMainWindow() {
|
void InteractiveWindow::parentNativeWindowToMainWindow() {
|
||||||
|
|
Loading…
Reference in a new issue