Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7c8c8c1e
Commit
7c8c8c1e
authored
Dec 11, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #884 from Hixie/cycles
Check for cycles in our various tree structures.
parents
2a2784e8
5996d381
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+14
-0
node.dart
packages/flutter/lib/src/rendering/node.dart
+7
-0
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+13
-0
node.dart
packages/flutter_sprites/lib/src/node.dart
+8
-0
No files found.
packages/flutter/lib/src/rendering/layer.dart
View file @
7c8c8c1e
...
...
@@ -52,6 +52,13 @@ abstract class Layer {
newLayer
.
_previousSibling
=
_previousSibling
;
if
(
_previousSibling
!=
null
)
newLayer
.
_previousSibling
.
_nextSibling
=
newLayer
;
assert
(()
{
Layer
node
=
this
;
while
(
node
.
parent
!=
null
)
node
=
node
.
parent
;
assert
(
node
!=
newLayer
);
// indicates we are about to create a cycle
return
true
;
});
newLayer
.
_parent
=
_parent
;
if
(
_parent
.
_firstChild
==
this
)
_parent
.
_firstChild
=
newLayer
;
...
...
@@ -182,6 +189,13 @@ class ContainerLayer extends Layer {
assert
(
child
.
_parent
==
null
);
assert
(
child
.
_nextSibling
==
null
);
assert
(
child
.
_previousSibling
==
null
);
assert
(()
{
Layer
node
=
this
;
while
(
node
.
parent
!=
null
)
node
=
node
.
parent
;
assert
(
node
!=
child
);
// indicates we are about to create a cycle
return
true
;
});
child
.
_parent
=
this
;
child
.
_previousSibling
=
_lastChild
;
if
(
_lastChild
!=
null
)
...
...
packages/flutter/lib/src/rendering/node.dart
View file @
7c8c8c1e
...
...
@@ -90,6 +90,13 @@ class AbstractNode {
void
adoptChild
(
AbstractNode
child
)
{
assert
(
child
!=
null
);
assert
(
child
.
_parent
==
null
);
assert
(()
{
AbstractNode
node
=
this
;
while
(
node
.
parent
!=
null
)
node
=
node
.
parent
;
assert
(
node
!=
child
);
// indicates we are about to create a cycle
return
true
;
});
child
.
_parent
=
this
;
if
(
attached
)
child
.
attach
();
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
7c8c8c1e
...
...
@@ -773,6 +773,7 @@ abstract class Element<T extends Widget> implements BuildContext {
Element
newChild
=
_findAndActivateElement
(
key
,
newWidget
);
if
(
newChild
!=
null
)
{
assert
(
newChild
.
_parent
==
null
);
assert
(()
{
_debugCheckForCycles
(
newChild
);
return
true
;
});
newChild
.
_parent
=
this
;
newChild
.
_updateDepth
();
newChild
.
attachRenderObject
(
newSlot
);
...
...
@@ -782,11 +783,23 @@ abstract class Element<T extends Widget> implements BuildContext {
}
}
Element
newChild
=
newWidget
.
createElement
();
assert
(()
{
_debugCheckForCycles
(
newChild
);
return
true
;
});
newChild
.
mount
(
this
,
newSlot
);
assert
(
newChild
.
_debugLifecycleState
==
_ElementLifecycle
.
active
);
return
newChild
;
}
void
_debugCheckForCycles
(
Element
newChild
)
{
assert
(
newChild
.
_parent
==
null
);
assert
(()
{
Element
node
=
this
;
while
(
node
.
_parent
!=
null
)
node
=
node
.
_parent
;
assert
(
node
!=
newChild
);
// indicates we are about to create a cycle
return
true
;
});
}
void
_deactivateChild
(
Element
child
)
{
assert
(
child
!=
null
);
assert
(
child
.
_parent
==
this
);
...
...
packages/flutter_sprites/lib/src/node.dart
View file @
7c8c8c1e
...
...
@@ -403,6 +403,14 @@ class Node {
assert
(
child
.
_parent
==
null
);
assert
(!(
child
is
PhysicsGroup
)
||
this
is
PhysicsGroup
||
this
is
PhysicsWorld
);
assert
(()
{
Node
node
=
this
;
while
(
node
.
parent
!=
null
)
node
=
node
.
parent
;
assert
(
node
!=
child
);
// indicates we are about to create a cycle
return
true
;
});
_childrenNeedSorting
=
true
;
_children
.
add
(
child
);
child
.
_parent
=
this
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment