Merge pull request #15933 from danteruiz/fix-interactive-deadlock

BUGZ-1014: Crash when opening Create
This commit is contained in:
Ryan Huffman 2019-07-16 09:05:50 -07:00 committed by GitHub
commit 117577cd29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 23 deletions

View file

@ -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

View file

@ -293,7 +293,11 @@ void InteractiveWindow::close() {
if (_dockWidget) { if (_dockWidget) {
auto window = qApp->getWindow(); auto window = qApp->getWindow();
if (QThread::currentThread() != window->thread()) {
BLOCKING_INVOKE_METHOD(window, "removeDockWidget", Q_ARG(QDockWidget*, _dockWidget.get())); 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() {