Applied patch [ 597320 ] Return wxNotebook::SetSelection value
By Hans Van Leemputten (hansvl) According to the documentation wxNotebook::SetSelection() should return the previous selection... (Like wxMSW does) but the wxUniv version returns the currently selected selection. Patch was tested with wxX11. Applied patch [ 597313 ] Popup menu still used after deletion By Hans Van Leemputten (hansvl) - This patch exists out of 2 parts; Part 1 is a patch to show the problem with the menu sample (this part is just to show the problem and should not be put into CVS!). Part 2 is the fix and should be put in CVS. (src/univ/menu.cpp) - Instructions to reproduce the problem with the menu sample: 1. Apply part 1 of the patch only. 2. Run the sample after recompiling it. 3. Press "Close Test" -> "Close", this will basically remove the current menu bar and recreate it again and re-use the menu item "Close test" from the old menu bar... 4. Again press "Close Test", doing this will already crash the sample. - The cause of the problem is that the m_popupMenu in wxMenu is deleted because it is a child of the old menu bar (Note: it does not get destroyed by the wxMenu destructor, but by DestroyChildren()) and m_popupMenu is not put back to NULL when this happens... - This patch was tested only with wxX11. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -314,6 +314,12 @@ wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
|
||||
|
||||
wxPopupMenuWindow::~wxPopupMenuWindow()
|
||||
{
|
||||
// When m_popupMenu in wxMenu is deleted because it
|
||||
// is a child of an old menu bar being deleted (note: it does
|
||||
// not get destroyed by the wxMenu destructor, but
|
||||
// by DestroyChildren()), m_popupMenu should be reset to NULL.
|
||||
|
||||
m_menu->m_popupMenu = NULL;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -255,7 +255,7 @@ int wxNotebook::SetSelection(int nPage)
|
||||
m_pages[m_sel]->Show();
|
||||
}
|
||||
|
||||
return m_sel;
|
||||
return selOld;
|
||||
}
|
||||
|
||||
void wxNotebook::ChangePage(int nPage)
|
||||
|
Reference in New Issue
Block a user