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
4cf1a350
Unverified
Commit
4cf1a350
authored
Aug 07, 2019
by
Michael Goderbauer
Committed by
GitHub
Aug 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove bogus code in ContainerParentDataMixin.detach (#37479)
parent
39a04dcd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
object.dart
packages/flutter/lib/src/rendering/object.dart
+2
-14
object_test.dart
packages/flutter/test/rendering/object_test.dart
+19
-0
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
4cf1a350
...
@@ -2834,21 +2834,9 @@ mixin ContainerParentDataMixin<ChildType extends RenderObject> on ParentData {
...
@@ -2834,21 +2834,9 @@ mixin ContainerParentDataMixin<ChildType extends RenderObject> on ParentData {
/// Clear the sibling pointers.
/// Clear the sibling pointers.
@override
@override
void
detach
()
{
void
detach
()
{
assert
(
previousSibling
==
null
,
'Pointers to siblings must be nulled before detaching ParentData.'
);
assert
(
nextSibling
==
null
,
'Pointers to siblings must be nulled before detaching ParentData.'
);
super
.
detach
();
super
.
detach
();
if
(
previousSibling
!=
null
)
{
final
ContainerParentDataMixin
<
ChildType
>
previousSiblingParentData
=
previousSibling
.
parentData
;
assert
(
previousSibling
!=
this
);
assert
(
previousSiblingParentData
.
nextSibling
==
this
);
previousSiblingParentData
.
nextSibling
=
nextSibling
;
}
if
(
nextSibling
!=
null
)
{
final
ContainerParentDataMixin
<
ChildType
>
nextSiblingParentData
=
nextSibling
.
parentData
;
assert
(
nextSibling
!=
this
);
assert
(
nextSiblingParentData
.
previousSibling
==
this
);
nextSiblingParentData
.
previousSibling
=
previousSibling
;
}
previousSibling
=
null
;
nextSibling
=
null
;
}
}
}
}
...
...
packages/flutter/test/rendering/object_test.dart
View file @
4cf1a350
...
@@ -81,8 +81,27 @@ void main() {
...
@@ -81,8 +81,27 @@ void main() {
),
),
);
);
});
});
test
(
'ContainerParentDataMixin requires nulled out pointers to siblings before detach'
,
()
{
expect
(()
=>
TestParentData
().
detach
(),
isNot
(
throwsAssertionError
));
final
TestParentData
data1
=
TestParentData
()
..
nextSibling
=
RenderOpacity
()
..
previousSibling
=
RenderOpacity
();
expect
(()
=>
data1
.
detach
(),
throwsAssertionError
);
final
TestParentData
data2
=
TestParentData
()
..
previousSibling
=
RenderOpacity
();
expect
(()
=>
data2
.
detach
(),
throwsAssertionError
);
final
TestParentData
data3
=
TestParentData
()
..
nextSibling
=
RenderOpacity
();
expect
(()
=>
data3
.
detach
(),
throwsAssertionError
);
});
}
}
class
TestParentData
extends
ParentData
with
ContainerParentDataMixin
<
RenderBox
>
{
}
class
TestRenderObject
extends
RenderObject
{
class
TestRenderObject
extends
RenderObject
{
@override
@override
void
debugAssertDoesMeetConstraints
()
{
}
void
debugAssertDoesMeetConstraints
()
{
}
...
...
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