MGR: Fix crash bug

svn path=/trunk/boinc/; revision=24459
This commit is contained in:
Charlie Fenton 2011-10-22 01:00:50 +00:00
parent 8e689c7434
commit 068e8823bb
3 changed files with 14 additions and 9 deletions

View File

@ -7657,3 +7657,9 @@ David 21 Oct 2011
tools/ tools/
update_versions update_versions
Charlie 21 Oct 2011
- MGR: Fix crash bug.
clientgui/
sg_BoincSimpleFrame.cpp,.h

View File

@ -119,9 +119,9 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint
); );
// Skins submenu // Skins submenu
wxMenu *submenuSkins = new wxMenu; m_pSubmenuSkins = new wxMenu;
BuildSkinSubmenu(submenuSkins); BuildSkinSubmenu(m_pSubmenuSkins);
// All other skin names will be appended as radio // All other skin names will be appended as radio
// menu items with ID_SGSKINSELECTOR // menu items with ID_SGSKINSELECTOR
@ -140,12 +140,12 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint
menuView->Append( menuView->Append(
ID_SGSKINSELECTOR, ID_SGSKINSELECTOR,
_("Skin"), _("Skin"),
submenuSkins, m_pSubmenuSkins,
_("Select the appearance of the user interface.") _("Select the appearance of the user interface.")
); );
// Skins sumenu always contains the Default entry // Skins sumenu always contains the Default entry
if (submenuSkins->GetMenuItemCount() <= 1) { if (m_pSubmenuSkins->GetMenuItemCount() <= 1) {
menuView->Enable(ID_SGSKINSELECTOR, false); menuView->Enable(ID_SGSKINSELECTOR, false);
} }
@ -403,8 +403,7 @@ void CSimpleFrame::OnSelectDefaultSkin( wxCommandEvent& WXUNUSED(event) ) {
} }
void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){ void CSimpleFrame::OnSelectSkin( wxCommandEvent& WXUNUSED(event) ){
wxMenu *theMenu;
size_t i, n; size_t i, n;
CSkinManager* pSkinManager = wxGetApp().GetSkinManager(); CSkinManager* pSkinManager = wxGetApp().GetSkinManager();
@ -413,10 +412,9 @@ void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){
wxString strSelectedSkin = pSkinManager->GetDefaultSkinName(); // For safety wxString strSelectedSkin = pSkinManager->GetDefaultSkinName(); // For safety
theMenu = (wxMenu*)event.GetEventObject(); n = m_pSubmenuSkins->GetMenuItemCount();
n = theMenu->GetMenuItemCount();
for (i=0; i<n; ++i) { for (i=0; i<n; ++i) {
wxMenuItem* item = theMenu->FindItemByPosition(i); wxMenuItem* item = m_pSubmenuSkins->FindItemByPosition(i);
if (item->IsChecked()) { if (item->IsChecked()) {
strSelectedSkin = item->GetItemLabelText(); strSelectedSkin = item->GetItemLabelText();
break; break;

View File

@ -134,6 +134,7 @@ protected:
virtual int _GetCurrentViewPage(); virtual int _GetCurrentViewPage();
wxMenuBar* m_pMenubar; wxMenuBar* m_pMenubar;
wxMenu* m_pSubmenuSkins;
wxAcceleratorEntry m_Shortcuts[1]; wxAcceleratorEntry m_Shortcuts[1];
wxAcceleratorTable* m_pAccelTable; wxAcceleratorTable* m_pAccelTable;