changeset 2418:86357e382e33

leaks
author zipi
date Tue, 22 Jul 2014 16:36:18 +0100
parents 15440e9ae7b6
children df09713d6531
files Render.cpp VideoPlayer.cpp
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Tue Jul 22 17:43:28 2014 +0600
+++ b/Render.cpp	Tue Jul 22 16:36:18 2014 +0100
@@ -802,7 +802,8 @@
       {
         delete [] v20.pDriverName;
         delete [] v20.pDeviceDesc;
-        free(v20.pDDraw4DevDesc);
+        //free(v20.pDDraw4DevDesc);
+		delete [] v20.pDDraw4DevDesc;
         delete v20.pGUID;
         v6 = (IUnknown *)pDirectDraw4;
       }
@@ -813,7 +814,8 @@
         pDirect3D3->EnumDevices((LPD3DENUMDEVICESCALLBACK)D3DDeviceEnumerator, &aux);
         delete [] v20.pDriverName;
         delete [] v20.pDeviceDesc;
-        free(v20.pDDraw4DevDesc);
+        //free(v20.pDDraw4DevDesc);
+		delete [] v20.pDDraw4DevDesc;
         delete v20.pGUID;
         pDirectDraw4->Release();
         v6 = (IUnknown *)pDirect3D3;
@@ -6393,7 +6395,9 @@
     }
     delete [] sprite_texture->pPixels;
     delete sprite_texture;
-    return true;
+	delete [] sprite_texture->pPixels;
+	delete sprite_texture;
+	return true;
   }
   return false;
 }
--- 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)