[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.
This commit is contained in:
Callum Fare 2025-07-14 16:17:10 +01:00 committed by GitHub
parent 074218dd10
commit 47c9609a86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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())