diff options
| author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-08-30 12:25:37 +0200 |
|---|---|---|
| committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-08-30 12:43:29 +0200 |
| commit | 286ca997d1ebfdd046c7dc1ada884de3fd6acc01 (patch) | |
| tree | cee001a2dea3027f4cb9a6d22e65228084d3e8a7 /src/quick/items/qquicktextedit.cpp | |
| parent | 7910426730fb1e3384d946f953cb1ef1455e11d2 (diff) | |
Fix thread issue in TextEdit when font db updates
This amends 2fb43a35dfa08bb0746913e3363f1fcf21815e72, which
introduced invalidation of text when the font database changes.
The text invalidation is done from the render thread, which
mostly works well because it is done during sync, so the main
thread is locked. However, for TextEdit, the invalidation is
more complex and would implicitly call documentChanged() which
would then try to stop a timer. Since the timer has to be
stopped from the owner thread, it would fail and throw a
warning.
So for TextEdit, we invoke the method on the main thread
instead, which means it will use one extra update pass
in order to properly invalidate its contents.
Pick-to: 6.4
Fixes: QTBUG-105992
Change-Id: Idc020c682dcb2d1f3c66d043cf98fe9c6e4dc2a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextedit.cpp')
| -rw-r--r-- | src/quick/items/qquicktextedit.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 3bc1db006a..c035486eda 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -405,6 +405,11 @@ void QQuickTextEdit::setText(const QString &text) void QQuickTextEdit::invalidate() { + QMetaObject::invokeMethod(this, &QQuickTextEdit::q_invalidate); +} + +void QQuickTextEdit::q_invalidate() +{ Q_D(QQuickTextEdit); if (isComponentComplete()) { if (d->document != nullptr) |
