X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ba4fbebbc40bdf9c140f4c9ba9977fbf810527d..6c34d0ede9d6f7086896a1e4467091f0360846de:/src/msw/dc.cpp diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 0598c60773..1863a0d1da 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -200,10 +200,15 @@ wxDC::~wxDC() } 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()); + if (m_canvas) + { + ::ReleaseDC(GetHwndOf(m_canvas), GetHdc()); + } + else + { + // Must have been a wxScreenDC + ::ReleaseDC((HWND) NULL, GetHdc()); + } } } }