Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
fff3309e
Commit
fff3309e
authored
14 years ago
by
dt
Browse files
Options
Downloads
Patches
Plain Diff
ProjectExplorer: Add expensive asserts to FlatModel
Should help in debugging QTCREATORBUG-2821
parent
c6d3f085
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/projectexplorer/projectmodels.cpp
+41
-0
41 additions, 0 deletions
src/plugins/projectexplorer/projectmodels.cpp
with
41 additions
and
0 deletions
src/plugins/projectexplorer/projectmodels.cpp
+
41
−
0
View file @
fff3309e
...
...
@@ -512,6 +512,16 @@ bool FlatModel::filter(Node *node) const
return
isHidden
;
}
bool
isSorted
(
const
QList
<
Node
*>
&
nodes
)
{
int
size
=
nodes
.
size
();
for
(
int
i
=
0
;
i
<
size
-
1
;
++
i
)
{
if
(
!
sortNodes
(
nodes
.
at
(
i
),
nodes
.
at
(
i
+
1
)))
return
false
;
}
return
true
;
}
/// slots and all the fun
void
FlatModel
::
added
(
FolderNode
*
parentNode
,
const
QList
<
Node
*>
&
newNodeList
)
{
...
...
@@ -526,6 +536,21 @@ void FlatModel::added(FolderNode* parentNode, const QList<Node*> &newNodeList)
QList
<
Node
*>::
const_iterator
oldIter
=
oldNodeList
.
constBegin
();
QList
<
Node
*>::
const_iterator
newIter
=
newNodeList
.
constBegin
();
Q_ASSERT
(
isSorted
(
oldNodeList
));
Q_ASSERT
(
isSorted
(
newNodeList
));
QSet
<
Node
*>
emptyDifference
;
emptyDifference
=
oldNodeList
.
toSet
();
emptyDifference
.
subtract
(
newNodeList
.
toSet
());
if
(
!
emptyDifference
.
isEmpty
())
{
// This should not happen...
qDebug
()
<<
"FlatModel::added, old Node list should be subset of newNode list, found files in old list which were not part of new list"
;
foreach
(
Node
*
n
,
emptyDifference
)
{
qDebug
()
<<
n
->
path
();
}
Q_ASSERT
(
false
);
}
// optimization, check for old list is empty
if
(
oldIter
==
oldNodeList
.
constEnd
())
{
// New Node List is empty, nothing added which intrest us
...
...
@@ -591,11 +616,27 @@ void FlatModel::removed(FolderNode* parentNode, const QList<Node*> &newNodeList)
QHash
<
FolderNode
*
,
QList
<
Node
*>
>::
const_iterator
it
=
m_childNodes
.
constFind
(
parentNode
);
if
(
it
==
m_childNodes
.
constEnd
())
return
;
QList
<
Node
*>
oldNodeList
=
it
.
value
();
// Compare lists and emit signals, and modify m_childNodes on the fly
QList
<
Node
*>::
const_iterator
oldIter
=
oldNodeList
.
constBegin
();
QList
<
Node
*>::
const_iterator
newIter
=
newNodeList
.
constBegin
();
Q_ASSERT
(
isSorted
(
oldNodeList
));
Q_ASSERT
(
isSorted
(
newNodeList
));
QSet
<
Node
*>
emptyDifference
;
emptyDifference
=
newNodeList
.
toSet
();
emptyDifference
.
subtract
(
oldNodeList
.
toSet
());
if
(
!
emptyDifference
.
isEmpty
())
{
// This should not happen...
qDebug
()
<<
"FlatModel::removed, new Node list should be subset of oldNode list, found files in new list which were not part of old list"
;
foreach
(
Node
*
n
,
emptyDifference
)
{
qDebug
()
<<
n
->
path
();
}
Q_ASSERT
(
false
);
}
// optimization, check for new list is empty
if
(
newIter
==
newNodeList
.
constEnd
())
{
// New Node List is empty, everything removed
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment