Add scoped autoreleasepool to tests and examples
This ensures ObjC objects do not leak. On non-Apple
platforms, the scope does nothing.
Fixed: dawn:546
Change-Id: Id43702e6536bf9cb37825a5449511e10cf0734f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/55841
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/examples/ManualSwapChainTest.cpp b/examples/ManualSwapChainTest.cpp
index e282af4..1c7d9dd 100644
--- a/examples/ManualSwapChainTest.cpp
+++ b/examples/ManualSwapChainTest.cpp
@@ -55,6 +55,7 @@
#include "common/Log.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/GLFWUtils.h"
+#include "utils/ScopedAutoreleasePool.h"
#include "utils/WGPUHelpers.h"
#include <dawn/dawn_proc.h>
@@ -334,6 +335,7 @@
AddWindow();
while (windows.size() != 0) {
+ utils::ScopedAutoreleasePool pool;
glfwPollEvents();
for (auto it = windows.begin(); it != windows.end();) {