Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Dispose thread-local command pools during teardown of Impeller golden…
… playground tests

On Vulkan the golden tests are using a single ContextVK instance that is shared
among all tests.  The ContextVK is never deleted by the test harness.

So when the test process exits there may still be a CommandPoolVK in the
thread-local map.  The map and the CommandPoolVK will then be destructed
when global and thread-local objects are destructed, which may be unsafe.

Calling DisposeThreadLocalCachedResources forces cleanup of the thread-local
map when each test case finishes.
  • Loading branch information
jason-simmons committed May 29, 2025
commit 2013bee9b2e6f791bb4495e671eb234c587e0ada
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ void GoldenPlaygroundTest::SetTypographerContext(

void GoldenPlaygroundTest::TearDown() {
ASSERT_FALSE(dlopen("/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD));

auto context = GetContext();
if (context) {
context->DisposeThreadLocalCachedResources();
}
}

namespace {
Expand Down Expand Up @@ -280,6 +285,9 @@ RuntimeStage::Map GoldenPlaygroundTest::OpenAssetAsRuntimeStage(
}

std::shared_ptr<Context> GoldenPlaygroundTest::GetContext() const {
if (!pimpl_->screenshotter) {
return nullptr;
}
return pimpl_->screenshotter->GetPlayground().GetContext();
}

Expand Down