Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexwild <alexwild@users.sourceforge.net>2007-10-01 18:19:20 +0400
committeralexwild <alexwild@users.sourceforge.net>2007-10-01 18:19:20 +0400
commit473495499972a51002385a1ffb6c1ea95ff9b0d1 (patch)
treec35517460ee2c59696231b6ee264029ee6f46b97 /src/apps/mplayerc/VMROSD.cpp
parent43281f742fd0ca58a8d58390674740a1e4efcc04 (diff)
fix enormous memory leak (many gigs ram) when resize window with renderer != overlay
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@270 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/VMROSD.cpp')
-rw-r--r--src/apps/mplayerc/VMROSD.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp
index 9c9e08591..cfd481e91 100644
--- a/src/apps/mplayerc/VMROSD.cpp
+++ b/src/apps/mplayerc/VMROSD.cpp
@@ -52,6 +52,7 @@ CVMROSD::CVMROSD(void)
CVMROSD::~CVMROSD(void)
{
+ DeleteDC(m_MemDC);
}
@@ -84,15 +85,18 @@ void CVMROSD::UpdateVMRBitmap()
{
BITMAPINFO bmi = {0};
HBITMAP hbmpRender;
+
+ ZeroMemory( &bmi.bmiHeader, sizeof(BITMAPINFOHEADER) );
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = m_rectWnd.Width();
bmi.bmiHeader.biHeight = - (int) m_rectWnd.Height(); // top-down
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
+
hbmpRender = CreateDIBSection( m_MemDC, &bmi, DIB_RGB_COLORS, NULL, NULL, NULL );
m_MemDC.SelectObject (hbmpRender);
-
+
if (::GetObject(hbmpRender, sizeof(BITMAP), &m_BitmapInfo) != 0)
{
// Configure the VMR's bitmap structure
@@ -111,6 +115,7 @@ void CVMROSD::UpdateVMRBitmap()
m_MemDC.SetTextColor(RGB(255, 255, 255));
m_MemDC.SetBkMode(TRANSPARENT);
}
+ DeleteObject(hbmpRender);
}
}
@@ -130,12 +135,15 @@ void CVMROSD::UpdateMFBitmap()
{
BITMAPINFO bmi = {0};
HBITMAP hbmpRender;
+
+ ZeroMemory( &bmi.bmiHeader, sizeof(BITMAPINFOHEADER) );
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = m_rectWnd.Width();
bmi.bmiHeader.biHeight = - (int) m_rectWnd.Height(); // top-down
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
+
hbmpRender = CreateDIBSection( m_MemDC, &bmi, DIB_RGB_COLORS, NULL, NULL, NULL );
m_MemDC.SelectObject (hbmpRender);
@@ -156,6 +164,7 @@ void CVMROSD::UpdateMFBitmap()
m_MemDC.SetTextColor(RGB(255, 255, 255));
m_MemDC.SetBkMode(TRANSPARENT);
}
+ DeleteObject(hbmpRender);
}
}