diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-07-30 14:14:50 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-07-30 17:30:57 +0200 |
commit | dfc6dc1d94a729f701172861a196b4b34bcd7518 (patch) | |
tree | 4868f263c0322e40000c75d8d90df90755f368eb /src | |
parent | 0944ff26223bd2c809025c9f42bc9935213f0d43 (diff) |
Fix possible crash with top/bottom aligned images
An image inside at the end of a text block which did not start at text
position 0 would resolve to an invalid QTextLine, since we passed
the document position to lineForTextPosition(), which expects the
relative block position. If the image was aligned to top or
bottom, so that the extracted QTextLine was actually accessed,
this would cause a crash.
[ChangeLog][QtQuick][Text] Fixed a bug where aligning an image
to "top" or "bottom" could cause a crash under certain circumstances.
Task-number: QTBUG-77217
Change-Id: Iaa239ba482f2a765703656e4116cbebb8435a66e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 36fc168ec2..5a4ef2b686 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -477,7 +477,7 @@ void QQuickTextNodeEngine::addTextObject(const QTextBlock &block, const QPointF } qreal ascent; - QTextLine line = block.layout()->lineForTextPosition(pos); + QTextLine line = block.layout()->lineForTextPosition(pos - block.position()); switch (format.verticalAlignment()) { case QTextCharFormat::AlignTop: |