Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: core/src/fxge/win32/fx_win32_device.cpp

Issue 1195363002: Cleanup: Do not check pointers before deleting them, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: nits Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 #include <crtdbg.h> 10 #include <crtdbg.h>
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 OSVERSIONINFO ver; 403 OSVERSIONINFO ver;
404 ver.dwOSVersionInfoSize = sizeof(ver); 404 ver.dwOSVersionInfoSize = sizeof(ver);
405 GetVersionEx(&ver); 405 GetVersionEx(&ver);
406 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5; 406 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5;
407 pPlatformData->m_GdiplusExt.Load(); 407 pPlatformData->m_GdiplusExt.Load();
408 m_pPlatformData = pPlatformData; 408 m_pPlatformData = pPlatformData;
409 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); 409 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
410 } 410 }
411 void CFX_GEModule::DestroyPlatform() 411 void CFX_GEModule::DestroyPlatform()
412 { 412 {
413 if (m_pPlatformData) { 413 delete (CWin32Platform*)m_pPlatformData;
414 delete (CWin32Platform*)m_pPlatformData;
415 }
416 m_pPlatformData = NULL; 414 m_pPlatformData = NULL;
417 } 415 }
418 CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class) 416 CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class)
419 { 417 {
420 m_hDC = hDC; 418 m_hDC = hDC;
421 m_DeviceClass = device_class; 419 m_DeviceClass = device_class;
422 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor mData(); 420 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor mData();
423 SetStretchBltMode(hDC, pPlatform->m_bHalfTone ? HALFTONE : COLORONCOLOR); 421 SetStretchBltMode(hDC, pPlatform->m_bHalfTone ? HALFTONE : COLORONCOLOR);
424 if (GetObjectType(m_hDC) == OBJ_MEMDC) { 422 if (GetObjectType(m_hDC) == OBJ_MEMDC) {
425 HBITMAP hBitmap = CreateBitmap(1, 1, 1, 1, NULL); 423 HBITMAP hBitmap = CreateBitmap(1, 1, 1, 1, NULL);
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 SelectObject(m_hDC, m_hOldBitmap); 1195 SelectObject(m_hDC, m_hOldBitmap);
1198 DeleteDC(m_hDC); 1196 DeleteDC(m_hDC);
1199 } 1197 }
1200 if (m_hBitmap) { 1198 if (m_hBitmap) {
1201 DeleteObject(m_hBitmap); 1199 DeleteObject(m_hBitmap);
1202 } 1200 }
1203 delete GetBitmap(); 1201 delete GetBitmap();
1204 } 1202 }
1205 1203
1206 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 1204 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
OLDNEW
« no previous file with comments | « core/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698