Commit 0173ed41 authored by Roman Sedaikin's avatar Roman Sedaikin

Moved instantiation d3dDevice below of all return statements to avoid memory leak.

parent 5053f1fd
......@@ -236,8 +236,6 @@ HRESULT D3DCompile(
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_Direct3DRedrawer_createDirectXDevice(
JNIEnv *env, jobject redrawer, jlong windowHandle)
{
DirectXDevice *d3dDevice = new DirectXDevice();
gr_cp<IDXGIFactory4> deviceFactory;
if (!SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&deviceFactory))))
{
......@@ -265,6 +263,7 @@ HRESULT D3DCompile(
return 0;
}
DirectXDevice *d3dDevice = new DirectXDevice();
d3dDevice->backendContext.fAdapter = hardwareAdapter;
d3dDevice->backendContext.fDevice = device;
d3dDevice->backendContext.fQueue = queue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment