From 0f55317632a6aa3a0c63482e08a8fa7e1aee8d7f Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 29 Jun 2023 09:33:26 -0700 Subject: [PATCH] [Impeller] Ensure that the auto-release pool is available when the GoldenPlaygroundTestImpl is destructed (flutter/engine#43322) --- .../impeller/golden_tests/golden_playground_test.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/impeller/golden_tests/golden_playground_test.h b/engine/src/flutter/impeller/golden_tests/golden_playground_test.h index 05fc5d09fe..a165fdd103 100644 --- a/engine/src/flutter/impeller/golden_tests/golden_playground_test.h +++ b/engine/src/flutter/impeller/golden_tests/golden_playground_test.h @@ -52,14 +52,16 @@ class GoldenPlaygroundTest ISize GetWindowSize() const; private: +#if FML_OS_MACOSX + // This must be placed first so that the autorelease pool is not destroyed + // until the GoldenPlaygroundTestImpl has been destructed. + fml::ScopedNSAutoreleasePool autorelease_pool_; +#endif + struct GoldenPlaygroundTestImpl; // This is only a shared_ptr so it can work with a forward declared type. std::shared_ptr pimpl_; -#if FML_OS_MACOSX - fml::ScopedNSAutoreleasePool autorelease_pool_; -#endif - FML_DISALLOW_COPY_AND_ASSIGN(GoldenPlaygroundTest); };