diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-08 15:34:51 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-29 14:58:33 (GMT) |
commit | 49d2906a9566c8b44df48f51ca137b9ba2feb671 (patch) | |
tree | 996d157291634a42f80133f51a600dc3b4bc23db /src/gui/text/qtextobject.cpp | |
parent | cb5e526c6023237c36aac3446a0a18288f39f3a9 (diff) | |
download | Qt-49d2906a9566c8b44df48f51ca137b9ba2feb671.zip Qt-49d2906a9566c8b44df48f51ca137b9ba2feb671.tar.gz Qt-49d2906a9566c8b44df48f51ca137b9ba2feb671.tar.bz2 |
Make sure removed QTextBlock is invalid
If the block is removed from document block map, we will mark the
right node to the current head->freelist index, but it shouldn't
be accessed directly, otherwise it can cause crash because of
uninitialized node.
Hence we need to check if a node index is equal to current freelist
index. If so, it cannot be a valid block.
Task-number: QTBUG-18500
Reviewed-by: Eskil
Diffstat (limited to 'src/gui/text/qtextobject.cpp')
-rw-r--r-- | src/gui/text/qtextobject.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 0a9dff8..5c1c8b9 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -891,6 +891,11 @@ QTextBlockUserData::~QTextBlockUserData() Returns true if this text block is valid; otherwise returns false. */ +bool QTextBlock::isValid() const +{ + return p != 0 && p->blockMap().isValid(n); +} + /*! \fn QTextBlock &QTextBlock::operator=(const QTextBlock &other) |