From 8e95772b1a0d4c892e5b3549b90b877056f1ab49 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 29 Aug 2014 11:55:56 +0000 Subject: [PATCH] Don't leave wxHtmlWinParser with a dangling wxDC pointer. Call SetDC(NULL) to prevent wxHtmlWinParser from using a pointer to the already destroyed wxDC object. See #16501. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmlwin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index fa2e924869..bdace9971b 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -485,6 +485,10 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc); + // The parser doesn't need the DC any more, so ensure it's not left with a + // dangling pointer after the DC object goes out of scope. + m_Parser->SetDC(NULL); + m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER); CreateLayout();