This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 2 files changed +19
-0
lines changed
shell/platform/darwin/macos/framework/Source
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ - (void)performCommit:(CGSize)size notify:(nonnull dispatch_block_t)notify {
79
79
fml::AutoResetWaitableEvent event;
80
80
{
81
81
std::unique_lock<std::mutex> lock (_mutex);
82
+ if (_shuttingDown) {
83
+ // FlutterView is shutting down and will not drain schedued blocks
84
+ // on main thread anymore.
85
+ return ;
86
+ }
82
87
fml::AutoResetWaitableEvent& e = event;
83
88
_scheduledBlocks.push_back (^{
84
89
notify ();
Original file line number Diff line number Diff line change 5
5
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterView.h"
6
6
7
7
#import < Metal/Metal.h>
8
+ #include < thread>
8
9
9
10
#import " flutter/testing/testing.h"
10
11
@@ -28,3 +29,16 @@ - (void)viewDidReshape:(nonnull NSView*)view {
28
29
reshapeListener: listener];
29
30
EXPECT_EQ ([view layer: view.layer shouldInheritContentsScale: 3.0 fromWindow: view.window], YES );
30
31
}
32
+
33
+ TEST (FlutterView, ThreadSynchronizerNotBlockingRasterThreadAfterShutdown) {
34
+ FlutterThreadSynchronizer* threadSynchronizer = [[FlutterThreadSynchronizer alloc ] init ];
35
+ [threadSynchronizer shutdown ];
36
+
37
+ std::thread rasterThread ([&threadSynchronizer] {
38
+ [threadSynchronizer performCommit: CGSizeMake (100 , 100 )
39
+ notify: ^{
40
+ }];
41
+ });
42
+
43
+ rasterThread.join ();
44
+ }
You can’t perform that action at this time.
0 commit comments