Open fredemmott opened 2 years ago
An issue (number 1687) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#1687 ), to facilitate working group processes.
This GitHub issue will continue to be the main site of discussion.
As well as being a 'hello, world' demo app, hello_xr is useful as a quick-launching test app when working on API layers (in my case, https://github.com/fredemmott/OpenKneeboard). For this case, it would be useful to make it a bit more 'well behaved'.
I tried using a
std::unique_ptr<>
to hold my resources, and callingxrDestroyFoo()
from my destructorThis makes
hello_xr
hang forever on ctrl-c, inside my calls toxrDestroySwapchain
orxrDestroySpace
; this seems to be because the openxr resources/functions have already been unloaded before my API layer's DLL is unloaded, and in turn, before my staticstd::unique_ptr
's destructor is called.To workaround, I'm using a raw pointer, and
delete
'ing from myxrDestroySession
override, which effectively leaks the resources on shutdown; this isn't directly a problem, but in general, it's good to be able to use RAII instead of raw pointers where possible.This could be done via
signal()
on unix-like platforms, orSetConsoleCtrlHandler()
on windows