From 47c9609a8637b68c0170744ce5c06902512e71ca Mon Sep 17 00:00:00 2001 From: Callum Fare Date: Mon, 14 Jul 2025 16:17:10 +0100 Subject: [PATCH] [Offload] Check plugins aren't already deinitialized when tearing down (#148642) This is a hotfix for #148615 - it fixes the issue for me locally. I think a broader issue is that in the test environment we're calling olShutDown from a global destructor in the test binaries. We should do something more controlled, either calling olInit/olShutDown in every test, or move those to a GTest global environment. I didn't do that originally because it looked like it needed changes to LLVM's GTest wrapper. --- offload/liboffload/src/OffloadImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp index 17a2b00cb714..c4e7f9689a90 100644 --- a/offload/liboffload/src/OffloadImpl.cpp +++ b/offload/liboffload/src/OffloadImpl.cpp @@ -231,7 +231,7 @@ Error olShutDown_impl() { for (auto &P : OldContext->Platforms) { // Host plugin is nullptr and has no deinit - if (!P.Plugin) + if (!P.Plugin || !P.Plugin->is_initialized()) continue; if (auto Res = P.Plugin->deinit())