From eac01d3d88ae5fb5f18b2d3581e9ece9d6e24097 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 29 Aug 2014 11:55:51 +0000 Subject: [PATCH] No changes, just avoid unnecessary heap allocation in wxHtmlWindow. Create the temporary wxClientDC on the stack, not the heap, there is no need for the latter. See #16501. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmlwin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index f9c78d6af2..fa2e924869 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -470,12 +470,12 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) } // ...and run the parser on it: - wxClientDC *dc = new wxClientDC(this); - dc->SetMapMode(wxMM_TEXT); + wxClientDC dc(this); + dc.SetMapMode(wxMM_TEXT); SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF)); SetBackgroundImage(wxNullBitmap); - m_Parser->SetDC(dc); + m_Parser->SetDC(&dc); // notice that it's important to set m_Cell to NULL here before calling // Parse() below, even if it will be overwritten by its return value as @@ -484,7 +484,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) wxDELETE(m_Cell); m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc); - delete dc; + m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER); CreateLayout();