Skip to content

Commit cfabc7f

Browse files
committed
Fix memory leak in CGammaControl and CHW. Fix memory problem in NvTriStripObjects.
1 parent 4dff95b commit cfabc7f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/Layers/xrRender/NvTriStripObjects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class NvEdgeInfo
7373
{
7474
if (--m_refCount == 0)
7575
{
76-
Memory.mem_free(this);
76+
delete this;
7777
}
7878
}
7979

src/Layers/xrRender/xr_effgamma.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ void CGammaControl::Update()
1212
IDXGIOutput* pOutput;
1313

1414
CHK_DX(HW.m_pSwapChain->GetContainingOutput(&pOutput));
15+
// Метод выполнится успешно только в полноэкранном режиме.
1516
HRESULT hr = pOutput->GetGammaControlCapabilities(&GC);
1617
if (SUCCEEDED(hr))
1718
{
1819
GenLUT(GC, G);
1920
pOutput->SetGammaControl(&G);
2021
}
22+
23+
_RELEASE(pOutput);
2124
}
2225
}
2326

src/Layers/xrRenderDX10/dx10HW.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ void CHW::CreateDevice(HWND m_hWnd, bool move_window)
155155
D3D_DRIVER_TYPE_UNKNOWN, // Если мы выбираем конкретный адаптер, то мы обязаны использовать D3D_DRIVER_TYPE_UNKNOWN.
156156
NULL, createDeviceFlags, pFeatureLevels, sizeof(pFeatureLevels) / sizeof(pFeatureLevels[0]),
157157
D3D11_SDK_VERSION, &pDevice, &FeatureLevel, &pContext);
158-
159-
R_CHK(m_pFactory->CreateSwapChain(pDevice, &sd, &m_pSwapChain));
160158
#else
161159
R = D3D10CreateDevice(m_pAdapter, m_DriverType, NULL, createDeviceFlags, D3D10_SDK_VERSION, &pDevice);
162160

@@ -225,7 +223,7 @@ void CHW::DestroyDevice()
225223
#ifndef USE_DX11
226224
_RELEASE(HW.pDevice1);
227225
#endif
228-
_SHOW_REF("DeviceREF:", HW.pDevice);
226+
_SHOW_REF("refCount:HW.pDevice:", HW.pDevice);
229227
_RELEASE(HW.pDevice);
230228

231229
DestroyD3D();

0 commit comments

Comments
 (0)