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

copypixelbuffer causes crash #10326

Merged
merged 3 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion shell/platform/darwin/ios/ios_external_texture_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "flutter/flow/texture.h"
#include "flutter/fml/platform/darwin/cf_utils.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h"

namespace flutter {
Expand All @@ -33,7 +34,7 @@ class IOSExternalTextureGL : public flutter::Texture {
bool NeedUpdateTexture(bool freeze);

bool new_frame_ready_ = false;
NSObject<FlutterTexture>* external_texture_;
fml::scoped_nsobject<NSObject<FlutterTexture>> external_texture_;
fml::CFRef<CVOpenGLESTextureCacheRef> cache_ref_;
fml::CFRef<CVOpenGLESTextureRef> texture_ref_;
fml::CFRef<CVPixelBufferRef> buffer_ref_;
Expand Down
5 changes: 3 additions & 2 deletions shell/platform/darwin/ios/ios_external_texture_gl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

IOSExternalTextureGL::IOSExternalTextureGL(int64_t textureId,
NSObject<FlutterTexture>* externalTexture)
: Texture(textureId), external_texture_(externalTexture) {
: Texture(textureId),
external_texture_(fml::scoped_nsobject<NSObject<FlutterTexture>>([externalTexture retain])) {
FML_DCHECK(external_texture_);
}

Expand Down Expand Up @@ -65,7 +66,7 @@
GrContext* context) {
EnsureTextureCacheExists();
if (NeedUpdateTexture(freeze)) {
auto pixelBuffer = [external_texture_ copyPixelBuffer];
auto pixelBuffer = [external_texture_.get() copyPixelBuffer];
if (pixelBuffer) {
buffer_ref_.Reset(pixelBuffer);
}
Expand Down