File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1227,7 +1227,7 @@ mixin SchedulerBinding on BindingBase {
1227
1227
try {
1228
1228
// PERSISTENT FRAME CALLBACKS
1229
1229
_schedulerPhase = SchedulerPhase .persistentCallbacks;
1230
- for (final FrameCallback callback in _persistentCallbacks) {
1230
+ for (final FrameCallback callback in List < FrameCallback >. of ( _persistentCallbacks) ) {
1231
1231
_invokeFrameCallback (callback, _currentFrameTimeStamp! );
1232
1232
}
1233
1233
Original file line number Diff line number Diff line change @@ -28,4 +28,21 @@ void main() {
28
28
);
29
29
timeDilation = 1.0 ;
30
30
});
31
+
32
+ test ('Adding a persistent frame callback during a persistent frame callback' , () {
33
+ bool calledBack = false ;
34
+ SchedulerBinding .instance.addPersistentFrameCallback ((Duration timeStamp) {
35
+ if (! calledBack) {
36
+ SchedulerBinding .instance.addPersistentFrameCallback ((Duration timeStamp) {
37
+ calledBack = true ;
38
+ });
39
+ }
40
+ });
41
+ SchedulerBinding .instance.handleBeginFrame (null );
42
+ SchedulerBinding .instance.handleDrawFrame ();
43
+ expect (calledBack, false );
44
+ SchedulerBinding .instance.handleBeginFrame (null );
45
+ SchedulerBinding .instance.handleDrawFrame ();
46
+ expect (calledBack, true );
47
+ });
31
48
}
You can’t perform that action at this time.
0 commit comments