Skip to content

Commit

Permalink
Fix memory leak in CGammaControl and CHW. Fix memory problem in NvTri…
Browse files Browse the repository at this point in the history
…StripObjects.
  • Loading branch information
intorr committed Feb 26, 2018
1 parent 4dff95b commit cfabc7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/NvTriStripObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class NvEdgeInfo
{
if (--m_refCount == 0)
{
Memory.mem_free(this);
delete this;
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/Layers/xrRender/xr_effgamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ void CGammaControl::Update()
IDXGIOutput* pOutput;

CHK_DX(HW.m_pSwapChain->GetContainingOutput(&pOutput));
// Метод выполнится успешно только в полноэкранном режиме.
HRESULT hr = pOutput->GetGammaControlCapabilities(&GC);
if (SUCCEEDED(hr))
{
GenLUT(GC, G);
pOutput->SetGammaControl(&G);
}

_RELEASE(pOutput);
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/Layers/xrRenderDX10/dx10HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ void CHW::CreateDevice(HWND m_hWnd, bool move_window)
D3D_DRIVER_TYPE_UNKNOWN, // Если мы выбираем конкретный адаптер, то мы обязаны использовать D3D_DRIVER_TYPE_UNKNOWN.
NULL, createDeviceFlags, pFeatureLevels, sizeof(pFeatureLevels) / sizeof(pFeatureLevels[0]),
D3D11_SDK_VERSION, &pDevice, &FeatureLevel, &pContext);

R_CHK(m_pFactory->CreateSwapChain(pDevice, &sd, &m_pSwapChain));
#else
R = D3D10CreateDevice(m_pAdapter, m_DriverType, NULL, createDeviceFlags, D3D10_SDK_VERSION, &pDevice);

Expand Down Expand Up @@ -225,7 +223,7 @@ void CHW::DestroyDevice()
#ifndef USE_DX11
_RELEASE(HW.pDevice1);
#endif
_SHOW_REF("DeviceREF:", HW.pDevice);
_SHOW_REF("refCount:HW.pDevice:", HW.pDevice);
_RELEASE(HW.pDevice);

DestroyD3D();
Expand Down

0 comments on commit cfabc7f

Please sign in to comment.