Revert logic when building with --force-asserts
This reverts commit f109f5b8a9
.
Instead of disabling the asserts, rather enable the debug code
so the asserts actually trigger.
Change-Id: I6f62588d836de5c926294241e8d7196a963e4aac
Reviewed-by: Eckhart Koppen <eckhart.koppen@nokia.com>
This commit is contained in:
parent
f1f95d7047
commit
cd6bd7aa11
@ -133,7 +133,7 @@ static bool isValidBlockSeparator(const QChar &ch)
|
|||||||
|| ch == QTextEndOfFrame;
|
|| ch == QTextEndOfFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
|
||||||
static bool noBlockInString(const QString &str)
|
static bool noBlockInString(const QString &str)
|
||||||
{
|
{
|
||||||
return !str.contains(QChar::ParagraphSeparator)
|
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)
|
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
|
||||||
{
|
{
|
||||||
// ##### optimize when only appending to the fragment!
|
// ##### optimize when only appending to the fragment!
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(noBlockInString(text.mid(strPos, length)));
|
Q_ASSERT(noBlockInString(text.mid(strPos, length)));
|
||||||
#endif
|
|
||||||
|
|
||||||
split(pos);
|
split(pos);
|
||||||
uint x = fragments.insert_single(pos, length);
|
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)
|
if (str.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(noBlockInString(str));
|
Q_ASSERT(noBlockInString(str));
|
||||||
#endif
|
|
||||||
|
|
||||||
int strPos = text.length();
|
int strPos = text.length();
|
||||||
text.append(str);
|
text.append(str);
|
||||||
@ -500,9 +496,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
|
|||||||
|
|
||||||
Q_ASSERT(blocks.size(b) > length);
|
Q_ASSERT(blocks.size(b) > length);
|
||||||
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == 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)));
|
Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
|
||||||
#endif
|
|
||||||
|
|
||||||
blocks.setSize(b, blocks.size(b)-length);
|
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)) {
|
if (key+1 != blocks.position(b)) {
|
||||||
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
|
// 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])));
|
Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
|
||||||
#endif
|
|
||||||
w = remove_string(key, X->size_array[0], op);
|
w = remove_string(key, X->size_array[0], op);
|
||||||
|
|
||||||
if (needsInsert) {
|
if (needsInsert) {
|
||||||
|
@ -3093,7 +3093,7 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
|
|
||||||
SectionSpan span(size, (end - start) + 1, mode);
|
SectionSpan span(size, (end - start) + 1, mode);
|
||||||
int start_section = 0;
|
int start_section = 0;
|
||||||
#ifndef QT_NO_DEBUG
|
#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
|
||||||
int initial_section_count = headerSectionCount(); // ### debug code
|
int initial_section_count = headerSectionCount(); // ### debug code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3115,16 +3115,12 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
sectionSpans[i].resizeMode = mode;
|
sectionSpans[i].resizeMode = mode;
|
||||||
// ### check if we can merge the section with any of its neighbours
|
// ### check if we can merge the section with any of its neighbours
|
||||||
removeSpans(spansToRemove);
|
removeSpans(spansToRemove);
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(initial_section_count == headerSectionCount());
|
Q_ASSERT(initial_section_count == headerSectionCount());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
} else if (start > start_section && end < end_section) {
|
} else if (start > start_section && end < end_section) {
|
||||||
if (sectionSpans.at(i).sectionSize() == span.sectionSize()
|
if (sectionSpans.at(i).sectionSize() == span.sectionSize()
|
||||||
&& sectionSpans.at(i).resizeMode == span.resizeMode) {
|
&& sectionSpans.at(i).resizeMode == span.resizeMode) {
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(initial_section_count == headerSectionCount());
|
Q_ASSERT(initial_section_count == headerSectionCount());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// the new span is in the middle of the old span, so we have to split it
|
// the new span is in the middle of the old span, so we have to split it
|
||||||
@ -3142,7 +3138,7 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
sectionSpans[i].resizeMode = span_mode;
|
sectionSpans[i].resizeMode = span_mode;
|
||||||
length += first_span_size;
|
length += first_span_size;
|
||||||
// middle span (the new span)
|
// middle span (the new span)
|
||||||
#ifndef QT_NO_DEBUG
|
#if !defined(QT_NO_DEBUG) || defined(QT_FORCE_ASSERTS)
|
||||||
int mid_span_count = span.count;
|
int mid_span_count = span.count;
|
||||||
#endif
|
#endif
|
||||||
int mid_span_size = span.size;
|
int mid_span_size = span.size;
|
||||||
@ -3153,13 +3149,9 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
int last_span_size = section_size * last_span_count;
|
int last_span_size = section_size * last_span_count;
|
||||||
sectionSpans.insert(i + 2, SectionSpan(last_span_size, last_span_count, span_mode));
|
sectionSpans.insert(i + 2, SectionSpan(last_span_size, last_span_count, span_mode));
|
||||||
length += last_span_size;
|
length += last_span_size;
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(span_count == first_span_count + mid_span_count + last_span_count);
|
Q_ASSERT(span_count == first_span_count + mid_span_count + last_span_count);
|
||||||
#endif
|
|
||||||
removeSpans(spansToRemove);
|
removeSpans(spansToRemove);
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(initial_section_count == headerSectionCount());
|
Q_ASSERT(initial_section_count == headerSectionCount());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
} else if (start > start_section && start <= end_section && end >= end_section) {
|
} else if (start > start_section && start <= end_section && end >= end_section) {
|
||||||
// the new span covers the last part of the existing span
|
// the new span covers the last part of the existing span
|
||||||
@ -3175,9 +3167,7 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
sectionSpans.insert(i + 1, span); // insert after
|
sectionSpans.insert(i + 1, span); // insert after
|
||||||
length += span.size;
|
length += span.size;
|
||||||
removeSpans(spansToRemove);
|
removeSpans(spansToRemove);
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(initial_section_count == headerSectionCount());
|
Q_ASSERT(initial_section_count == headerSectionCount());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (end < end_section && end >= start_section && start <= start_section) {
|
} else if (end < end_section && end >= start_section && start <= start_section) {
|
||||||
@ -3193,9 +3183,7 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
|
|||||||
sectionSpans.insert(i, span); // insert before
|
sectionSpans.insert(i, span); // insert before
|
||||||
length += span.size;
|
length += span.size;
|
||||||
removeSpans(spansToRemove);
|
removeSpans(spansToRemove);
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
Q_ASSERT(initial_section_count == headerSectionCount());
|
Q_ASSERT(initial_section_count == headerSectionCount());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
start_section += section_count;
|
start_section += section_count;
|
||||||
|
Loading…
Reference in New Issue
Block a user