diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-11-07 20:30:39 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-11-09 13:22:29 +0100 |
commit | 963f3c678ca8282bd3e1d8af5f8669baaddb1686 (patch) | |
tree | f6e052352f2d5f739aa59cc4dbf19c1877531434 /src/gui | |
parent | cb9d76169aefc95f4e8962dcbff98bedd63a3e50 (diff) |
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 <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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)); } } |