mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix Memory Leak in MakeSkSurfaceFromBackingStore (flutter/engine#30735)
This commit is contained in:
parent
40365e0cbb
commit
bcbd90ac89
@ -558,6 +558,7 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
|
||||
if (captures->destruction_callback) {
|
||||
captures->destruction_callback(captures->user_data);
|
||||
}
|
||||
delete captures;
|
||||
};
|
||||
|
||||
auto surface = SkSurface::MakeRasterDirectReleaseProc(
|
||||
@ -565,7 +566,7 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
|
||||
const_cast<void*>(software->allocation), // pixels
|
||||
software->row_bytes, // row bytes
|
||||
release_proc, // release proc
|
||||
captures.release() // release context
|
||||
captures.get() // get context
|
||||
);
|
||||
|
||||
if (!surface) {
|
||||
@ -576,6 +577,9 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
if (surface) {
|
||||
captures.release(); // Skia has assumed ownership of the struct.
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user