summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.cpp
diff options
context:
space:
mode:
authorEckhart Koppen <eckhart.koppen@nokia.com>2011-11-16 09:47:45 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-16 09:08:07 +0100
commitf109f5b8a9c7e6939dfd6c6f72a3b67548f5483c (patch)
tree0f40dc245f835efa9e21f256fdb816edb52bdfd6 /src/gui/text/qtextdocument_p.cpp
parent18affc8c0aa5180e9538713bbe9d415c3b08f7b7 (diff)
Fix Q_ASSERT usage in case -force-asserts is enabled
Certain Q_ASSERT usages are not compiling with -force-asserts since they are checking for instance variables or other items which are not available in release mode. This fix guards the asserts to only be enabled in debug mode. Change-Id: I2ed74e3d5118608361e8c924e93d8ff0efdc8eab Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r--src/gui/text/qtextdocument_p.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index f4cb742d34..e70c5e63b5 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -322,7 +322,9 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
{
// ##### optimize when only appending to the fragment!
+#ifndef QT_NO_DEBUG
Q_ASSERT(noBlockInString(text.mid(strPos, length)));
+#endif
split(pos);
uint x = fragments.insert_single(pos, length);
@@ -478,7 +480,9 @@ void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
if (str.size() == 0)
return;
+#ifndef QT_NO_DEBUG
Q_ASSERT(noBlockInString(str));
+#endif
int strPos = text.length();
text.append(str);
@@ -496,7 +500,9 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
Q_ASSERT(blocks.size(b) > length);
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
+#ifndef QT_NO_DEBUG
Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
+#endif
blocks.setSize(b, blocks.size(b)-length);
@@ -630,7 +636,9 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
+#ifndef QT_NO_DEBUG
Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
+#endif
w = remove_string(key, X->size_array[0], op);
if (needsInsert) {