Fix crash in the splitter sample due to replacing null window
The sample could crash after the following sequence of actions: 1. Resize splitter to hide the right/left window. 2. Activate replace menu action. Fix this by checking if the window being replaced is non-null. Closes https://github.com/wxWidgets/wxWidgets/pull/1672
This commit is contained in:
committed by
Vadim Zeitlin
parent
9fbf97ae97
commit
1222ac3d7f
@@ -448,8 +448,10 @@ void MyFrame::OnReplace(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (m_replacewindow == NULL) {
|
||||
m_replacewindow = m_splitter->GetWindow2();
|
||||
if (m_replacewindow != NULL) {
|
||||
m_splitter->ReplaceWindow(m_replacewindow, new wxPanel(m_splitter, wxID_ANY));
|
||||
m_replacewindow->Hide();
|
||||
}
|
||||
} else {
|
||||
wxWindow *empty = m_splitter->GetWindow2();
|
||||
wxASSERT(empty != m_replacewindow);
|
||||
|
Reference in New Issue
Block a user