From c1ec259d108272165f25b2ce3e8b4723db20c812 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Sat, 13 Jan 2007 21:08:50 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11854 --- checkin_notes | 13 +++++++++++++ clientgui/BOINCGridCtrl.cpp | 5 +++-- clientgui/sg_DlgMessages.cpp | 7 +------ clientgui/sg_DlgMessages.h | 2 -- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/checkin_notes b/checkin_notes index 361d50fbb7..17d04265b4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -517,3 +517,16 @@ David 12 Jan 2007 clientgui/ ViewWork.cpp ViewWorkGrid.cpp + +Rom 13 Jan 2007 + - MGR: Streamline the message dialog sync operation a little bit. + - MGR: Fix crashing issue do to invalid type casts, wxWidgets implements + its own form of type casts for C++ objects which probably uses + the basic RTTI of the compiler at some level, but it also has a few + checks and balences as well. So if you get a hankering of using + dynamic_cast or static_cast use wxDynamicCast and wxStaticCast + instead. + + clientgui/ + sg_DlgMessages.cpp + BOINCGridCtrl.cpp diff --git a/clientgui/BOINCGridCtrl.cpp b/clientgui/BOINCGridCtrl.cpp index 13e254d354..8f4762f695 100644 --- a/clientgui/BOINCGridCtrl.cpp +++ b/clientgui/BOINCGridCtrl.cpp @@ -683,7 +683,8 @@ void CBOINCGridCellRenderer::DoNormalTextDrawing(wxGrid& grid, wxGridCellAttr& a SetTextColoursAndFont(grid, attr, dc, isSelected); //get a real grid class pointer - CBOINCGridCtrl* bgrid = dynamic_cast (&grid); + CBOINCGridCtrl* bgrid = wxDynamicCast(&grid, CBOINCGridCtrl); + //use the overloaded method here bgrid->DrawTextRectangle(dc, grid.GetCellValue(row, col), rect, hAlign, vAlign); @@ -867,5 +868,5 @@ int CBOINCGridTable::FindRowIndexByColValue(int col,wxString& value) { /* for convinience purposes only */ CBOINCGridTable* CBOINCGridCtrl::GetTable() { - return dynamic_cast(wxGrid::GetTable()); + return wxDynamicCast(wxGrid::GetTable(), CBOINCGridTable); } diff --git a/clientgui/sg_DlgMessages.cpp b/clientgui/sg_DlgMessages.cpp index fbab8fd7ec..a5dce8e2af 100644 --- a/clientgui/sg_DlgMessages.cpp +++ b/clientgui/sg_DlgMessages.cpp @@ -347,7 +347,7 @@ void CPanelMessages::OnRefresh(wxTimerEvent& event) { wxASSERT(m_pList); - wxInt32 iDocCount = GetDocCount(); + wxInt32 iDocCount = wxGetApp().GetDocument()->GetMessageCount(); if (0 >= iDocCount) { m_pList->DeleteAllItems(); } else { @@ -531,11 +531,6 @@ bool CPanelMessages::OnRestoreState(wxConfigBase* pConfig) { } -wxInt32 CPanelMessages::GetDocCount() { - return wxGetApp().GetDocument()->GetMessageCount(); -} - - wxString CPanelMessages::OnListGetItemText(long item, long column) const { wxString strBuffer = wxEmptyString; diff --git a/clientgui/sg_DlgMessages.h b/clientgui/sg_DlgMessages.h index a075c64b60..cb484a659a 100644 --- a/clientgui/sg_DlgMessages.h +++ b/clientgui/sg_DlgMessages.h @@ -146,8 +146,6 @@ private: wxInt32 CopyToClipboard( wxInt32 item ); bool CloseClipboard(); #endif - - wxInt32 GetDocCount(); };