From cd6bd7aa1154c7869e8f71c4dc2201d0959b4ebe Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 16 Nov 2011 11:56:48 +0100 Subject: Revert logic when building with --force-asserts This reverts commit f109f5b8a9c7e6939dfd6c6f72a3b67548f5483c. Instead of disabling the asserts, rather enable the debug code so the asserts actually trigger. Change-Id: I6f62588d836de5c926294241e8d7196a963e4aac Reviewed-by: Eckhart Koppen --- src/gui/text/qtextdocument_p.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/gui/text/qtextdocument_p.cpp') diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index e70c5e63b5..901375d8c8 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -133,7 +133,7 @@ static bool isValidBlockSeparator(const QChar &ch) || ch == QTextEndOfFrame; } -#ifndef QT_NO_DEBUG +#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS) static bool noBlockInString(const QString &str) { return !str.contains(QChar::ParagraphSeparator) @@ -322,9 +322,7 @@ 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); @@ -480,9 +478,7 @@ 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); @@ -500,9 +496,7 @@ 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); @@ -636,9 +630,7 @@ 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) { -- cgit v1.2.3