Remove some sanity checks, no longer needed

Silenced a false-positive warning about anchor visibility.
It was invisible because we're within a main window show()

It will be checked by the unit-tests and fuzzer anyway. No need to
do it in production.
This commit is contained in:
Sergio Martins
2019-10-22 14:47:02 +01:00
parent e4eac7a688
commit 83f6bb8daf
2 changed files with 8 additions and 12 deletions

View File

@@ -430,7 +430,6 @@ void MultiSplitterLayout::ensureAnchorsBounded()
//Ensures all separators are within their bounds, meaning all items obey their min size
positionStaticAnchors();
ensureItemsMinSize();
checkSanity();
}
static Anchor::List removeSmallestPath(QVector<Anchor::List> &paths)
@@ -1117,7 +1116,6 @@ Anchor *MultiSplitterLayout::newAnchor(AnchorGroup &group, Location location)
qCDebug(::anchors) << "MultiSplitterLayout::newAnchor" << location;
Anchor *newAnchor = nullptr;
Anchor *donor = nullptr;
Q_ASSERT(checkSanity(AnchorSanity_Normal));
switch (location) {
case Location_OnLeft:
donor = group.left;
@@ -1148,10 +1146,6 @@ Anchor *MultiSplitterLayout::newAnchor(AnchorGroup &group, Location location)
Q_ASSERT(donor);
Q_ASSERT(donor != newAnchor);
if (!checkSanity(AnchorSanity_Normal)) {
qWarning() << "MultiSplitterLayout::newAnchor no sanity!";
}
updateAnchorsFromTo(donor, newAnchor);
qCDebug(::anchors()) << newAnchor->hasNonPlaceholderItems(Anchor::Side1)
@@ -1356,11 +1350,12 @@ bool MultiSplitterLayout::checkSanity(AnchorSanityOption options) const
return false;
}
if (multiSplitter()->isVisible() && !anchor->isFollowing() && !anchor->separatorWidget()->isVisible()) {
qWarning() << Q_FUNC_INFO << "Anchor should be visible" << anchor;
return false;
if (options & AnchorSanity_Visibility) {
if (multiSplitter()->isVisible() && !anchor->isFollowing() && !anchor->separatorWidget()->isVisible()) {
qWarning() << Q_FUNC_INFO << "Anchor should be visible" << anchor;
return false;
}
}
}
for (Item *item : qAsConst(m_items)) {
@@ -1466,7 +1461,7 @@ bool MultiSplitterLayout::checkSanity(AnchorSanityOption options) const
void MultiSplitterLayout::maybeCheckSanity()
{
#if defined(DOCKS_DEVELOPER_MODE)
if (!isRestoringPlaceholder() && !checkSanity())
if (!isRestoringPlaceholder() && !checkSanity(AnchorSanityOption(AnchorSanity_All & ~AnchorSanity_Visibility)))
qWarning() << Q_FUNC_INFO << "Sanity check failed";
#endif
}

View File

@@ -318,7 +318,8 @@ public:
AnchorSanity_WidgetInvalidSizes = 4,
AnchorSanity_Followers = 8,
AnchorSanity_WidgetGeometry = 16,
AnchorSanity_All = AnchorSanity_Intersections | AnchorSanity_WidgetMinSizes | AnchorSanity_WidgetInvalidSizes | AnchorSanity_Followers | AnchorSanity_WidgetGeometry
AnchorSanity_Visibility = 32,
AnchorSanity_All = AnchorSanity_Intersections | AnchorSanity_WidgetMinSizes | AnchorSanity_WidgetInvalidSizes | AnchorSanity_Followers | AnchorSanity_WidgetGeometry | AnchorSanity_Visibility
};
Q_ENUM(AnchorSanityOption)