Fix crash when using OpenXR extension wrappers from GDExtension

(cherry picked from commit 713ea0629a)
This commit is contained in:
David Snopek 2024-02-22 16:50:39 -06:00 committed by Rémi Verschelde
parent 17e50c629c
commit 4142e57082
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 1 deletions

View File

@ -1422,8 +1422,14 @@ void OpenXRAPI::register_extension_metadata() {
void OpenXRAPI::cleanup_extension_wrappers() {
for (OpenXRExtensionWrapper *extension_wrapper : registered_extension_wrappers) {
// Fix crash when the extension wrapper comes from GDExtension.
OpenXRExtensionWrapperExtension *gdextension_extension_wrapper = dynamic_cast<OpenXRExtensionWrapperExtension *>(extension_wrapper);
if (gdextension_extension_wrapper) {
memdelete(gdextension_extension_wrapper);
} else {
memdelete(extension_wrapper);
}
}
registered_extension_wrappers.clear();
}