Fix returning a freed context when initialization fails for GHOST/Win32
This commit is contained in:
parent
4df3cf020b
commit
ff651a08b5
|
@ -353,6 +353,7 @@ GHOST_ContextD3D *GHOST_SystemWin32::createOffscreenContextD3D()
|
|||
context = new GHOST_ContextD3D(false, wnd);
|
||||
if (context->initializeDrawingContext() == GHOST_kFailure) {
|
||||
delete context;
|
||||
context = nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
|
|
|
@ -624,11 +624,9 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
|
|||
GHOST_Context *context;
|
||||
|
||||
context = new GHOST_ContextD3D(false, m_hWnd);
|
||||
if (context->initializeDrawingContext()) {
|
||||
return context;
|
||||
}
|
||||
else {
|
||||
if (!context->initializeDrawingContext()) {
|
||||
delete context;
|
||||
context = nullptr;
|
||||
}
|
||||
|
||||
return context;
|
||||
|
|
Loading…
Reference in New Issue