diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-08 17:34:51 +0200 |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-11 10:44:39 +0200 |
commit | b033bb91ea6fd32989cc59904aa79db9a188bf5b (patch) | |
tree | 9d8fafe53ed61130c07afb98546dfe1a9b3de49f /src/gui/text/qtextobject.cpp | |
parent | 32372616ed942685c7367d6aee58a7fd3849cc0b (diff) |
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 94f2fc7184..a403cc5f1c 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) |