diff VideoPlayer.cpp @ 2418:86357e382e33

leaks
author zipi
date Tue, 22 Jul 2014 16:36:18 +0100
parents f4af3b203f65
children d922225a6081
line wrap: on
line diff
--- a/VideoPlayer.cpp	Tue Jul 22 17:43:28 2014 +0600
+++ b/VideoPlayer.cpp	Tue Jul 22 16:36:18 2014 +0100
@@ -119,8 +119,8 @@
 
     HDC     dc = GetDC(hwnd);
     HDC     back_dc = CreateCompatibleDC(dc);
-    HBITMAP back_bmp;
-    SelectObject(back_dc, back_bmp = CreateCompatibleBitmap(dc, client_width, client_height));
+	HBITMAP back_bmp = CreateCompatibleBitmap(dc, client_width, client_height);
+    SelectObject(back_dc, back_bmp);
 
 	DWORD t = GetTickCount();//текущее время от запуска ОС
 
@@ -172,15 +172,17 @@
         SetDIBits(back_dc, back_bmp, 0, client_height, image, &bmi, DIB_RGB_COLORS);
         BitBlt(dc, 0, 0, client_width, client_height, back_dc, 0, 0, SRCCOPY);
 
-        delete[] image;//удалить кадр
       }
 
+	  delete[] image;//удалить кадр
+
       GUI_MainMenuMessageProc();  //после отрисовки, т.к. иначе вылетает dt = 0.03, image - ???
 
       if (pVideoPlayer->bStopBeforeSchedule == 1)//остановка видео
         Sleep(1000); //пауза после видеоролика
     }
-
+	DeleteObject(back_bmp);
+	DeleteObject(back_dc);
     pVideoPlayer->Unload();
 
     if (a4 == 1)