1. fixes to wxDC deleting logic (should fix ~wxPrinterDC leak), some code
reorganized/removed 2. applied (slightly modified) wxEnhMetaFileSimpleDataObject patch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,23 +183,29 @@ wxDC::wxDC()
|
||||
|
||||
m_windowExtX = VIEWPORT_EXTENT;
|
||||
m_windowExtY = VIEWPORT_EXTENT;
|
||||
|
||||
m_hDCCount = 0;
|
||||
}
|
||||
|
||||
|
||||
wxDC::~wxDC()
|
||||
{
|
||||
if ( m_hDC != 0 ) {
|
||||
if ( m_hDC != 0 )
|
||||
{
|
||||
SelectOldObjects(m_hDC);
|
||||
if ( m_bOwnsDC ) {
|
||||
if ( m_canvas == NULL )
|
||||
::DeleteDC(GetHdc());
|
||||
else
|
||||
::ReleaseDC((HWND)m_canvas->GetHWND(), GetHdc());
|
||||
|
||||
// if we own the HDC, we delete it, otherwise we just release it
|
||||
|
||||
if ( m_bOwnsDC )
|
||||
{
|
||||
::DeleteDC(GetHdc());
|
||||
}
|
||||
else // we don't own our HDC
|
||||
{
|
||||
// this is not supposed to happen as we can't free the HDC then
|
||||
wxCHECK_RET( m_canvas, _T("no canvas in not owning ~wxDC?") );
|
||||
|
||||
::ReleaseDC(GetHwndOf(m_canvas), GetHdc());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This will select current objects out of the DC,
|
||||
|
Reference in New Issue
Block a user