From 068e8823bb521b9cf793ee7846ce52c1f664ee31 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 22 Oct 2011 01:00:50 +0000 Subject: [PATCH] MGR: Fix crash bug svn path=/trunk/boinc/; revision=24459 --- checkin_notes | 6 ++++++ clientgui/sg_BoincSimpleFrame.cpp | 16 +++++++--------- clientgui/sg_BoincSimpleFrame.h | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/checkin_notes b/checkin_notes index 5e0691d31b..5a1b77ab0f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7657,3 +7657,9 @@ David 21 Oct 2011 tools/ update_versions + +Charlie 21 Oct 2011 + - MGR: Fix crash bug. + + clientgui/ + sg_BoincSimpleFrame.cpp,.h diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp index 542061f65e..10797c3ce8 100755 --- a/clientgui/sg_BoincSimpleFrame.cpp +++ b/clientgui/sg_BoincSimpleFrame.cpp @@ -119,9 +119,9 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint ); // Skins submenu - wxMenu *submenuSkins = new wxMenu; + m_pSubmenuSkins = new wxMenu; - BuildSkinSubmenu(submenuSkins); + BuildSkinSubmenu(m_pSubmenuSkins); // All other skin names will be appended as radio // menu items with ID_SGSKINSELECTOR @@ -140,12 +140,12 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint menuView->Append( ID_SGSKINSELECTOR, _("Skin"), - submenuSkins, + m_pSubmenuSkins, _("Select the appearance of the user interface.") ); // Skins sumenu always contains the Default entry - if (submenuSkins->GetMenuItemCount() <= 1) { + if (m_pSubmenuSkins->GetMenuItemCount() <= 1) { menuView->Enable(ID_SGSKINSELECTOR, false); } @@ -403,8 +403,7 @@ void CSimpleFrame::OnSelectDefaultSkin( wxCommandEvent& WXUNUSED(event) ) { } -void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){ - wxMenu *theMenu; +void CSimpleFrame::OnSelectSkin( wxCommandEvent& WXUNUSED(event) ){ size_t i, n; CSkinManager* pSkinManager = wxGetApp().GetSkinManager(); @@ -413,10 +412,9 @@ void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){ wxString strSelectedSkin = pSkinManager->GetDefaultSkinName(); // For safety - theMenu = (wxMenu*)event.GetEventObject(); - n = theMenu->GetMenuItemCount(); + n = m_pSubmenuSkins->GetMenuItemCount(); for (i=0; iFindItemByPosition(i); + wxMenuItem* item = m_pSubmenuSkins->FindItemByPosition(i); if (item->IsChecked()) { strSelectedSkin = item->GetItemLabelText(); break; diff --git a/clientgui/sg_BoincSimpleFrame.h b/clientgui/sg_BoincSimpleFrame.h index 5a008a5869..59596acf78 100644 --- a/clientgui/sg_BoincSimpleFrame.h +++ b/clientgui/sg_BoincSimpleFrame.h @@ -134,6 +134,7 @@ protected: virtual int _GetCurrentViewPage(); wxMenuBar* m_pMenubar; + wxMenu* m_pSubmenuSkins; wxAcceleratorEntry m_Shortcuts[1]; wxAcceleratorTable* m_pAccelTable;