]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dc.cpp
Fix to excule OnPaint from WXPM
[wxWidgets.git] / src / msw / dc.cpp
index 0598c60773db239a58ebed2e1953955853413ac5..1863a0d1da6daf2dd4d0a87a6112768c110c0b1d 100644 (file)
@@ -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());
+            }
         }
     }
 }