зеркало из https://github.com/AvaloniaUI/angle.git
Metal: Fixed memory leak due to the CAMetalLayer still attached to super layer
When destroying SurfaceMtl, the CAMetalLayer should detach from its super layer, otherwise memory leak could happen. This memory leak caused the end2end tests to ran out of memory. Bug: angleproject:2634 Change-Id: I8ea91cccdb42cf0ae8ef807cf01f1e05043dc7c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2060250 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
5f5292c86e
Коммит
ee89849b7c
|
@ -226,7 +226,13 @@ void SurfaceMtl::destroy(const egl::Display *display)
|
|||
mDepthTexture = nullptr;
|
||||
mStencilTexture = nullptr;
|
||||
mCurrentDrawable = nil;
|
||||
mMetalLayer = nil;
|
||||
if (mMetalLayer && mMetalLayer.get() != mLayer)
|
||||
{
|
||||
// If we created metal layer in SurfaceMtl::initialize(),
|
||||
// we need to detach it from super layer now.
|
||||
[mMetalLayer.get() removeFromSuperlayer];
|
||||
}
|
||||
mMetalLayer = nil;
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::initialize(const egl::Display *display)
|
||||
|
|
Загрузка…
Ссылка в новой задаче