mirror of https://github.com/BOINC/boinc.git
MGR: Simplify Messages display logic; fix possible memory leaks; fix button tooltip.
svn path=/trunk/boinc/; revision=15998
This commit is contained in:
parent
573c33bb5c
commit
8c97c33dca
|
@ -7426,11 +7426,19 @@ Charlie 13 Sep 2008
|
|||
ViewWork.cpp
|
||||
|
||||
Charlie 14 Sep 2008
|
||||
- MGR: async GUI RPCs: Finish processing event handling for each RPC
|
||||
- MGR: Async GUI RPCs: Finish processing event handling for each RPC
|
||||
before starting next RPC, because the 2 RPCs may write into the
|
||||
same buffer, especially when switching between Simple and Advanced
|
||||
GUIs.
|
||||
- MGR: Simplify Messages display logic; fix "Show all messages" button
|
||||
tooltip.
|
||||
- MGR: Call Clear() instead of Empty() to fix possible memory leaks.
|
||||
|
||||
clientgui/
|
||||
AsyncRPC.cpp
|
||||
BOINCBaseFrame.cpp,.h
|
||||
BOINCBaseView.cpp
|
||||
BOINCListCtrl.cpp
|
||||
MainDocument.cpp
|
||||
sg_BoincSimpleGUI.cpp
|
||||
ViewMessages.cpp
|
||||
|
|
|
@ -43,7 +43,6 @@ DEFINE_EVENT_TYPE(wxEVT_FRAME_INITIALIZED)
|
|||
DEFINE_EVENT_TYPE(wxEVT_FRAME_REFRESHVIEW)
|
||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_UPDATESTATUS)
|
||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_RELOADSKIN)
|
||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_UPDATEMESSAGES)
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CBOINCBaseFrame, wxFrame)
|
||||
|
@ -54,7 +53,6 @@ BEGIN_EVENT_TABLE (CBOINCBaseFrame, wxFrame)
|
|||
EVT_TIMER(ID_PERIODICRPCTIMER, CBOINCBaseFrame::OnPeriodicRPC)
|
||||
EVT_FRAME_INITIALIZED(CBOINCBaseFrame::OnInitialized)
|
||||
EVT_FRAME_ALERT(CBOINCBaseFrame::OnAlert)
|
||||
EVT_FRAME_UPDATEMESSAGES(CBOINCBaseFrame::OnUpdateMessages)
|
||||
EVT_FRAME_REFRESH(CBOINCBaseFrame::OnRefreshView)
|
||||
EVT_CLOSE(CBOINCBaseFrame::OnClose)
|
||||
EVT_MENU(ID_FILECLOSEWINDOW, CBOINCBaseFrame::OnCloseWindow)
|
||||
|
@ -349,23 +347,6 @@ void CBOINCBaseFrame::OnExit(wxCommandEvent& WXUNUSED(event)) {
|
|||
}
|
||||
|
||||
|
||||
void CBOINCBaseFrame::OnUpdateMessages(CFrameEvent& ) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateMessages - Function Begin"));
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
pDoc->CachedMessageUpdate();
|
||||
|
||||
CFrameEvent refreshEvent(wxEVT_FRAME_REFRESHVIEW, this);
|
||||
AddPendingEvent(refreshEvent);
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateMessages - Function End"));
|
||||
}
|
||||
|
||||
|
||||
void CBOINCBaseFrame::FireInitialize() {
|
||||
CFrameEvent event(wxEVT_FRAME_INITIALIZED, this);
|
||||
AddPendingEvent(event);
|
||||
|
@ -380,6 +361,11 @@ void CBOINCBaseFrame::FireRefreshView() {
|
|||
|
||||
pDoc->RunPeriodicRPCs();
|
||||
|
||||
int currentTabView = wxGetApp().GetCurrentViewPage();
|
||||
if (currentTabView & (VW_MSGS | VW_SGUI)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CFrameEvent event(wxEVT_FRAME_REFRESHVIEW, this);
|
||||
AddPendingEvent(event);
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ public:
|
|||
virtual void OnClose( wxCloseEvent& event );
|
||||
virtual void OnCloseWindow( wxCommandEvent& event );
|
||||
virtual void OnExit( wxCommandEvent& event );
|
||||
void OnUpdateMessages( CFrameEvent& event );
|
||||
|
||||
|
||||
int GetReminderFrequency() { return m_iReminderFrequency; }
|
||||
wxString GetDialupConnectionName() { return m_strNetworkDialupConnectionName; }
|
||||
|
@ -185,7 +183,6 @@ DECLARE_EVENT_TYPE( wxEVT_FRAME_INITIALIZED, 10004 )
|
|||
DECLARE_EVENT_TYPE( wxEVT_FRAME_REFRESHVIEW, 10005 )
|
||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_UPDATESTATUS, 10006 )
|
||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_RELOADSKIN, 10007 )
|
||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_UPDATEMESSAGES, 10008 )
|
||||
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
|
@ -195,7 +192,6 @@ END_DECLARE_EVENT_TYPES()
|
|||
#define EVT_FRAME_REFRESH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_REFRESHVIEW, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||
#define EVT_FRAME_UPDATESTATUS(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_UPDATESTATUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||
#define EVT_FRAME_RELOADSKIN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_RELOADSKIN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||
#define EVT_FRAME_UPDATEMESSAGES(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_UPDATEMESSAGES, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -138,9 +138,9 @@ CBOINCBaseView::~CBOINCBaseView() {
|
|||
if (m_SortArrows) {
|
||||
delete m_SortArrows;
|
||||
}
|
||||
m_arrSelectedKeys1.Empty();
|
||||
m_arrSelectedKeys2.Empty();
|
||||
m_iSortedIndexes.Empty();
|
||||
m_arrSelectedKeys1.Clear();
|
||||
m_arrSelectedKeys2.Clear();
|
||||
m_iSortedIndexes.Clear();
|
||||
|
||||
if (m_pWhiteBackgroundAttr) {
|
||||
delete m_pWhiteBackgroundAttr;
|
||||
|
@ -590,8 +590,8 @@ void CBOINCBaseView::EmptyTasks() {
|
|||
|
||||
|
||||
void CBOINCBaseView::ClearSavedSelections() {
|
||||
m_arrSelectedKeys1.Empty();
|
||||
m_arrSelectedKeys2.Empty();
|
||||
m_arrSelectedKeys1.Clear();
|
||||
m_arrSelectedKeys2.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -602,8 +602,8 @@ void CBOINCBaseView::SaveSelections() {
|
|||
return;
|
||||
}
|
||||
|
||||
m_arrSelectedKeys1.Empty();
|
||||
m_arrSelectedKeys2.Empty();
|
||||
m_arrSelectedKeys1.Clear();
|
||||
m_arrSelectedKeys2.Clear();
|
||||
m_bIgnoreUIEvents = true;
|
||||
int i = -1;
|
||||
while (1) {
|
||||
|
|
|
@ -67,7 +67,7 @@ CBOINCListCtrl::CBOINCListCtrl(
|
|||
|
||||
CBOINCListCtrl::~CBOINCListCtrl()
|
||||
{
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
m_iRowsNeedingProgressBars.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -269,7 +269,7 @@ void CBOINCListCtrl::DrawBarGraphs()
|
|||
#endif
|
||||
|
||||
if (progressColumn < 0) {
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
m_iRowsNeedingProgressBars.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ void CBOINCListCtrl::DrawBarGraphs()
|
|||
dc.DrawRectangle( r );
|
||||
}
|
||||
}
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
m_iRowsNeedingProgressBars.Clear();
|
||||
}
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
|
|
|
@ -734,10 +734,10 @@ void CMainDocument::RunPeriodicRPCs() {
|
|||
|
||||
int currentTabView = wxGetApp().GetCurrentViewPage();
|
||||
|
||||
// TODO: modify SimpleGUI to not do RPCs when hidden / minimized
|
||||
// TODO: modify SimpleGUI to not do direct RPC calls when hidden / minimized
|
||||
if (! ((currentTabView & VW_SGUI) || pFrame->IsShown()) ) return;
|
||||
|
||||
// several functions (such as Abort, Reset, Detach) display an
|
||||
// Several functions (such as Abort, Reset, Detach) display an
|
||||
// "Are you sure?" dialog before passing a pointer to a result
|
||||
// or project in a demand RPC call. If Periodic RPCs continue
|
||||
// to run during these dialogs, that pointer may no longer be
|
||||
|
@ -864,7 +864,7 @@ void CMainDocument::RunPeriodicRPCs() {
|
|||
request.arg2 = &messages;
|
||||
// request.arg2 = &async_messages_buf;
|
||||
// request.exchangeBuf = &messages;
|
||||
request.event = new CFrameEvent(wxEVT_FRAME_UPDATEMESSAGES, pFrame);
|
||||
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||
// finished, which may have changed since request was made
|
||||
request.completionTime = NULL;
|
||||
|
@ -1705,9 +1705,7 @@ MESSAGE* CMainDocument::message(unsigned int i) {
|
|||
int CMainDocument::GetMessageCount() {
|
||||
int iCount = -1;
|
||||
|
||||
// CachedMessageUpdate() is now called from
|
||||
// CAdvancedFrame::OnUpdateMessages() and
|
||||
// CPanelMessages::OnRefresh()
|
||||
CachedMessageUpdate();
|
||||
CachedStateUpdate();
|
||||
|
||||
if (!messages.messages.empty()) {
|
||||
|
@ -1721,7 +1719,6 @@ int CMainDocument::GetMessageCount() {
|
|||
int CMainDocument::ResetMessageState() {
|
||||
messages.clear();
|
||||
m_iMessageSequenceNumber = 0;
|
||||
// m_iGet_messages_rpc_result = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@ void CViewMessages::OnMessagesCopyAll( wxCommandEvent& WXUNUSED(event) ) {
|
|||
#endif
|
||||
|
||||
UpdateSelection();
|
||||
pFrame->FireRefreshView();
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopyAll - Function End"));
|
||||
}
|
||||
|
@ -220,7 +219,7 @@ void CViewMessages::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) {
|
|||
|
||||
wxInt32 iIndex = -1;
|
||||
|
||||
pFrame->UpdateStatusText(_("Aborting transfer..."));
|
||||
pFrame->UpdateStatusText(_("Copying selected messages to the clipboard..."));
|
||||
OpenClipboard();
|
||||
|
||||
for (;;) {
|
||||
|
@ -238,7 +237,6 @@ void CViewMessages::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) {
|
|||
#endif
|
||||
|
||||
UpdateSelection();
|
||||
pFrame->FireRefreshView();
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopySelected - Function End"));
|
||||
}
|
||||
|
@ -288,8 +286,10 @@ void CViewMessages::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
|
|||
m_pListPane->DeleteAllItems();
|
||||
m_pListPane->SetItemCount(m_iFilteredDocCount);
|
||||
UpdateSelection();
|
||||
pFrame->FireRefreshView();
|
||||
pFrame->UpdateStatusText(wxT(""));
|
||||
CFrameEvent event(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||
pFrame->AddPendingEvent(event);
|
||||
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesFilter - Function End"));
|
||||
}
|
||||
|
@ -383,9 +383,9 @@ void CViewMessages::OnListRender (wxTimerEvent& event) {
|
|||
pDoc->GetConnectedComputerName(strNewMachineName);
|
||||
if (strLastMachineName != strNewMachineName) {
|
||||
strLastMachineName = strNewMachineName;
|
||||
if (iRowCount) {
|
||||
m_pListPane->EnsureVisible(iRowCount - 1);
|
||||
}
|
||||
if (iRowCount) {
|
||||
m_pListPane->EnsureVisible(iRowCount - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ void CViewMessages::UpdateSelection() {
|
|||
m_pTaskPane->UpdateTask(
|
||||
pGroup->m_Tasks[BTN_FILTERMSGS],
|
||||
_("Show all messages"),
|
||||
_("Resume tasks for this project.")
|
||||
_("Show messages for all projects.")
|
||||
);
|
||||
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_FILTERMSGS]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue