Blender Git Commit Log

Git Commits -> Revision 74fc1db

July 17, 2019, 11:35 (GMT)
Add helper class to RAII manage OpenXR handles

Adds generic unique_oxr_ptr to wrap xrCreate and xrDestroy functions of
OpenXR handles into a unique_ptr like RAII interface.

While for most cases, OpenXR resources can be freed by their owning
object, sometimes errors may occor before final ownership is established.
E.g. swapchain ownership is only transfered to the session object once
its swapchain-images are created - which may fail. With this RAII
wrapper, the swapchain would be freed on error (as this triggers stack
unwinding through an exception), no matter who holds ownership to it
currently.
There are other solutions to this problem, e.g. by establishing final
ownership right after/upon creation, or by explicit freeing in case an
error is spotted; it's too easy to make mistakes here though. Plus, we
may want to experiment with using this API for all OpenXR resources, to
entirely avoid the possibility of them leaking.

Commit Details:

Full Hash: 74fc1db25b8bf3327c029566b9d10e50a3eb591e
Parent Commit: 03ff2a8
Lines Changed: +65, -0

By: Miika HämäläinenLast update: Nov-07-2014 14:18 MiikaHweb | 2003-2019