Revert "trivial" change of r61772.
The "slight code simplification" of r61772 broke the code as it could now crash if dangling m_Cell pointer was used during parsing. Revert it and add a comment explaining why the code is written in the way it is. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -468,8 +468,14 @@ bool wxHtmlWindow::DoSetPage(const wxString& source)
 | 
				
			|||||||
    SetBackgroundImage(wxNullBitmap);
 | 
					    SetBackgroundImage(wxNullBitmap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_Parser->SetDC(dc);
 | 
					    m_Parser->SetDC(dc);
 | 
				
			||||||
 | 
					    if (m_Cell)
 | 
				
			||||||
    delete m_Cell;
 | 
					    {
 | 
				
			||||||
 | 
					        delete m_Cell;
 | 
				
			||||||
 | 
					        // 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:
 | 
				
			||||||
 | 
					        // without this we may crash if it's used from inside Parse()
 | 
				
			||||||
 | 
					        m_Cell = NULL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);
 | 
					    m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);
 | 
				
			||||||
    delete dc;
 | 
					    delete dc;
 | 
				
			||||||
    m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
 | 
					    m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user