Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d9d893e

Browse files
committed
CR fixes modulo adding a test.
1 parent d677997 commit d9d893e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

shell/platform/darwin/macos/framework/Source/FlutterEngine.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ - (void)setViewController:(FlutterViewController*)controller {
279279

280280
if (controller) {
281281
[_openGLRenderer attachToFlutterView:controller.flutterView];
282+
} else {
283+
[_openGLRenderer clearResourceContext];
282284
}
283285

284286
if (!controller && !_allowHeadlessExecution) {
285-
[_openGLRenderer clearResourceContext];
286287
[self shutDownEngine];
287288
}
288289
}

shell/platform/darwin/macos/framework/Source/FlutterOpenGLRenderer.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ @implementation FlutterOpenGLRenderer {
4848

4949
FlutterView* _flutterView;
5050

51-
// The context that is owned by the currently displayed FlutterView. This is stashed
52-
// in the renderer so that the view doesn't need to be accessed from a background thread.
51+
// The context provided to the Flutter engine for rendering to the FlutterView. This is lazily
52+
// created during initialization of the FlutterView. This is used to render content into the
53+
// FlutterView.
5354
NSOpenGLContext* _openGLContext;
5455

5556
// The context provided to the Flutter engine for resource loading.
@@ -140,7 +141,7 @@ - (int64_t)registerTexture:(id<FlutterTexture>)texture {
140141
FlutterExternalTextureGL* FlutterTexture =
141142
[[FlutterExternalTextureGL alloc] initWithFlutterTexture:texture];
142143
int64_t textureID = [FlutterTexture textureID];
143-
auto success = _embedderAPI.RegisterExternalTexture(_engine, textureID);
144+
FlutterEngineResult success = _embedderAPI.RegisterExternalTexture(_engine, textureID);
144145
if (success == FlutterEngineResult::kSuccess) {
145146
_textures[@(textureID)] = FlutterTexture;
146147
return textureID;
@@ -151,14 +152,14 @@ - (int64_t)registerTexture:(id<FlutterTexture>)texture {
151152
}
152153

153154
- (void)textureFrameAvailable:(int64_t)textureID {
154-
auto success = _embedderAPI.MarkExternalTextureFrameAvailable(_engine, textureID);
155+
FlutterEngineResult success = _embedderAPI.MarkExternalTextureFrameAvailable(_engine, textureID);
155156
if (success != FlutterEngineResult::kSuccess) {
156157
NSLog(@"Unable to mark texture with id %lld as available.", textureID);
157158
}
158159
}
159160

160161
- (void)unregisterTexture:(int64_t)textureID {
161-
auto success = _embedderAPI.UnregisterExternalTexture(_engine, textureID);
162+
FlutterEngineResult success = _embedderAPI.UnregisterExternalTexture(_engine, textureID);
162163
if (success == FlutterEngineResult::kSuccess) {
163164
[_textures removeObjectForKey:@(textureID)];
164165
} else {

0 commit comments

Comments
 (0)