Skip to content

Commit

Permalink
Fix crash when using OpenXR extension wrappers from GDExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Feb 22, 2024
1 parent 16d6142 commit 713ea06
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/openxr/openxr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,13 @@ void OpenXRAPI::register_extension_metadata() {

void OpenXRAPI::cleanup_extension_wrappers() {
for (OpenXRExtensionWrapper *extension_wrapper : registered_extension_wrappers) {
memdelete(extension_wrapper);
// 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();
}
Expand Down

0 comments on commit 713ea06

Please sign in to comment.