Queue CanvasImage texture deletion to the IO thread (flutter/engine#3091)

The UI thread does not have an EGL context, so attempting to delete an
SkImage on that thread will fail to delete the image's texture, resulting
in resource leaks
This commit is contained in:
Jason Simmons
2016-10-03 16:50:37 -07:00
committed by GitHub
parent 673942bf77
commit 0394c396a3

View File

@@ -4,6 +4,7 @@
#include "flutter/lib/ui/painting/image.h"
#include "flutter/common/threads.h"
#include "lib/tonic/dart_args.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/converter/dart_converter.h"
@@ -28,7 +29,10 @@ void CanvasImage::RegisterNatives(tonic::DartLibraryNatives* natives) {
CanvasImage::CanvasImage() {}
CanvasImage::~CanvasImage() {}
CanvasImage::~CanvasImage() {
SkImage* image = image_.release();
Threads::IO()->PostTask([image]() { image->unref(); });
}
void CanvasImage::dispose() {
ClearDartWrapper();