From f989eba75afc8464d9b5a3df6a8f8df4e3b51186 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 27 Aug 2009 01:46:20 +0000 Subject: [PATCH] MGR: Bug fixes for Linux svn path=/trunk/boinc/; revision=18925 --- checkin_notes | 12 ++++++++++++ clientgui/AsyncRPC.cpp | 2 +- clientgui/BOINCBaseView.cpp | 7 ++++--- clientgui/BOINCClientManager.cpp | 14 ++++++++++++-- clientgui/MainDocument.cpp | 6 ++++++ clientgui/MainDocument.h | 1 + clientgui/ViewMessages.cpp | 2 +- clientgui/sg_DlgMessages.cpp | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/checkin_notes b/checkin_notes index 8ac5b33460..c24d767e8f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7254,3 +7254,15 @@ David 26 Aug 2009 sched/ sched_types.cpp,h sched_send.cpp + +Charlie 26 Aug 2009 + MGR: Bug fixes for Linux. + + clientgui/ + AsyncRPC.cpp + BOINCBaseView.cpp + BOINCClientManager.cpp + MainDocument.cpp,.h + sg_DlgMessages.cpp + ViewMessages.cpp + diff --git a/clientgui/AsyncRPC.cpp b/clientgui/AsyncRPC.cpp index c7fa52e90d..8a66bf2c4e 100755 --- a/clientgui/AsyncRPC.cpp +++ b/clientgui/AsyncRPC.cpp @@ -361,7 +361,7 @@ void *RPCThread::Entry() { #endif // ifndef NO_PER_THREAD_LOCALE m_pRPC_Thread_Mutex->Lock(); - + m_pDoc->m_bRPCThreadIsReady = true; while(true) { // Wait for main thread to wake us // This does the following: diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index d03c19d6d4..e3f4d63423 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -295,9 +295,10 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (iDocCount > 0) { SynchronizeCache(); - - if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { - m_pListPane->EnsureVisible(iDocCount - 1); + if (iDocCount > 1) { + if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { + m_pListPane->EnsureVisible(iDocCount - 1); + } } if (m_pListPane->m_bIsSingleSelection) { diff --git a/clientgui/BOINCClientManager.cpp b/clientgui/BOINCClientManager.cpp index c5e3f0319f..26b721e724 100644 --- a/clientgui/BOINCClientManager.cpp +++ b/clientgui/BOINCClientManager.cpp @@ -38,9 +38,9 @@ enum { NewStyleDaemon = 1, OldStyleDaemon }; -#endif -#ifdef __WXMSW__ +#elif defined(__WXMSW__) + #include "win_util.h" #include "diagnostics_win.h" @@ -52,6 +52,9 @@ EXTERN_C BOOL IsBOINCServiceStopping(); EXTERN_C BOOL IsBOINCServiceStopped(); EXTERN_C BOOL StartBOINCService(); EXTERN_C BOOL StopBOINCService(); + +#else +#include #endif CBOINCClientManager::CBOINCClientManager() { @@ -155,6 +158,13 @@ bool CBOINCClientManager::IsBOINCCoreRunning() { std::vector piv; int retval; + if (m_lBOINCCoreProcessId) { + // Prevent client from being a zombie + if (waitpid(m_lBOINCCoreProcessId, 0, WNOHANG) == m_lBOINCCoreProcessId) { + m_lBOINCCoreProcessId = 0; + } + } + // Look for BOINC Client in list of all running processes retval = procinfo_setup(piv); if (retval) return false; // Should never happen diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 9b8caf08fd..d3b2933940 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -444,6 +444,7 @@ int CMainDocument::OnInit() { m_bWaitingForRPC = false; m_bNeedRefresh = false; m_bNeedTaskBarRefresh = false; + m_bRPCThreadIsReady = false; m_bShutDownRPCThread = false; current_rpc_request.clear(); @@ -472,6 +473,11 @@ int CMainDocument::OnInit() { wxASSERT(!iRetVal); m_RPCThread->Run(); + for (int i=0; i<100; i++) { + if (!m_bRPCThreadIsReady) { + boinc_sleep(0.01); // Allow RPC thread to initialize itself + } + } return iRetVal; } diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index ef2c7c4c08..6fc0c179c7 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -182,6 +182,7 @@ public: wxDialog* GetRPCWaitDialog() { return m_RPCWaitDlg; } // void TestAsyncRPC(); // For testing Async RPCs RPCThread* m_RPCThread; + bool m_bRPCThreadIsReady; bool m_bShutDownRPCThread; private: diff --git a/clientgui/ViewMessages.cpp b/clientgui/ViewMessages.cpp index 68e424ce47..864e5b8f68 100644 --- a/clientgui/ViewMessages.cpp +++ b/clientgui/ViewMessages.cpp @@ -393,7 +393,7 @@ void CViewMessages::OnListRender (wxTimerEvent& event) { } } - if ((iRowCount) && (_EnsureLastItemVisible()) && (m_iPreviousRowCount != iRowCount)) { + if ((iRowCount>1) && (_EnsureLastItemVisible()) && (m_iPreviousRowCount != iRowCount)) { m_pListPane->EnsureVisible(iRowCount - 1); } diff --git a/clientgui/sg_DlgMessages.cpp b/clientgui/sg_DlgMessages.cpp index a9a7602739..9af64dad28 100644 --- a/clientgui/sg_DlgMessages.cpp +++ b/clientgui/sg_DlgMessages.cpp @@ -361,7 +361,7 @@ void CPanelMessages::OnRefresh() { } } - if ((iDocCount) && (EnsureLastItemVisible()) && (m_iPreviousDocCount != iDocCount)) { + if ((iDocCount > 1) && (EnsureLastItemVisible()) && (m_iPreviousDocCount != iDocCount)) { m_pList->EnsureVisible(iDocCount - 1); }