Fix memory leak in Windows's jawtrenderer.

cusax-fix
Sebastien Vincent 16 years ago
parent eb0df0c7bd
commit 2e52bb6444

@ -36,17 +36,22 @@ void JAWTRenderer_close
if(blitter->surface)
{
delete blitter->surface;
blitter->surface = NULL;
}
if(blitter->device)
{
delete blitter->device;
blitter->device = NULL;
}
if(blitter->d3d)
{
delete blitter->d3d;
blitter->d3d = NULL;
}
delete blitter;
}
jlong JAWTRenderer_open(JNIEnv *jniEnv, jclass clazz, jobject component)

@ -70,15 +70,15 @@ D3DDevice::D3DDevice(HWND hwnd, LPDIRECT3D9 d3d, size_t width, size_t height,
D3DDevice::~D3DDevice()
{
if(m_device)
if(m_backSurface)
{
m_device->Release();
m_device = NULL;
m_backSurface->Release();
}
if(m_backSurface)
if(m_device)
{
m_backSurface->Release();
m_device->Release();
m_device = NULL;
}
}
@ -185,7 +185,7 @@ void D3DDevice::render(D3DSurface* surface)
/* copy content on surface */
m_device->UpdateSurface(surfacePointer, NULL, m_backSurface, NULL);
/* finish scence and cleanup */
/* finish scene and cleanup */
m_device->EndScene();
m_backSurface->Release();
m_backSurface = NULL;

Loading…
Cancel
Save