diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-01 20:35:14 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-01 20:38:05 +0300 |
commit | baca8611e5fe4b3dcd6f5065fb125bc0a9d65934 (patch) | |
tree | bb1230387cd53b15f9621f10c4d0e5e2050b5580 /intern/ghost/intern/GHOST_Xr.cpp | |
parent | 31705201dddebf7e3be5c4533b89f380aad1ede1 (diff) | |
parent | 2930d4fcea405985f2212c5f28c061af7c4849f8 (diff) |
Merge branch 'master' into active-fcurve-keyframeactive-fcurve-keyframe
Diffstat (limited to 'intern/ghost/intern/GHOST_Xr.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_Xr.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_Xr.cpp b/intern/ghost/intern/GHOST_Xr.cpp index dc63aac217c..2c94aaab430 100644 --- a/intern/ghost/intern/GHOST_Xr.cpp +++ b/intern/ghost/intern/GHOST_Xr.cpp @@ -31,7 +31,7 @@ GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info) { - GHOST_XrContext *xr_context = new GHOST_XrContext(create_info); + auto xr_context = std::make_unique<GHOST_XrContext>(create_info); /* TODO GHOST_XrContext's should probably be owned by the GHOST_System, which will handle context * creation and destruction. Try-catch logic can be moved to C-API then. */ @@ -40,12 +40,11 @@ GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *cre } catch (GHOST_XrException &e) { xr_context->dispatchErrorMessage(&e); - delete xr_context; - return nullptr; } - return (GHOST_XrContextHandle)xr_context; + /* Give ownership to the caller. */ + return (GHOST_XrContextHandle)xr_context.release(); } void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_contexthandle) |