From 963f3c678ca8282bd3e1d8af5f8669baaddb1686 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 7 Nov 2022 20:30:39 +0100 Subject: [PATCH] QTextDocument::loadResource(): invoke parent via direct connection If QTextDocument::loadResource() gets called from a different thread than the thread that the QTD object (and *necessarily* its parent, if it has one) live in, we would get the warning "Unable to invoke methods with return values in queued connections". Rather, ensure that it's invoked only via a direct connection. Amends ac300a166f801a6f6c0b15278e6893720a5726f8 Pick-to: 6.4 Task-number: QTBUG-35688 Change-Id: I35644f7cd54b1f40362d3d45c2a120883f7a2e61 Reviewed-by: Fabian Kosmale Reviewed-by: Volker Hilsheimer --- src/gui/text/qtextdocument.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index cdef0abd63..a6675422cd 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2235,7 +2235,8 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) int index = me->indexOfMethod("loadResource(int,QUrl)"); if (index >= 0) { QMetaMethod loader = me->method(index); - loader.invoke(p, Q_RETURN_ARG(QVariant, r), Q_ARG(int, type), Q_ARG(QUrl, name)); + // don't invoke() via a queued connection: this function needs to return a value + loader.invoke(p, Qt::DirectConnection, Q_RETURN_ARG(QVariant, r), Q_ARG(int, type), Q_ARG(QUrl, name)); } }