Commit d95bf694 authored by Charlie Fenton's avatar Charlie Fenton Committed by Oliver Bock

Mgr: Clear our internal Internet cache when selecting a different computer;...

Mgr: Clear our internal Internet cache when selecting a different computer; when removing entries from hash table, delete data to avoid memory leaks
parent a78f458c
......@@ -7833,6 +7833,10 @@ Rom 20 Dec 2012
Charlie 21 Dec 2012
- Mgr: If network activity is suspended, don't retrieve URL references within
notices unless they are already in our cache or in the Windows cache.
- Mgr: Clear our internal Internet cache when selecting a different computer;
when removing entries from hash table, delete data to avoid memory leaks.
clientgui/
BOINCInternetFSHandler.cpp
BOINCInternetFSHandler.cpp,.h
NoticeListCtrl.cpp
ViewNotices.cpp
......@@ -626,17 +626,32 @@ void CBOINCInternetFSHandler::UnchacheMissingItems() {
m_Hash->BeginFind();
wxHashTable::Node* node = m_Hash->Next();
for(;;) {
if (node == NULL) return;
if (node == NULL) return; // End of cache
MemFSHashObj* obj = (MemFSHashObj*)node->GetData();
// We must get next node before deleting this one
node = m_Hash->Next();
if (obj->m_Len == 0) {
delete obj;
m_Hash->Delete(obj->m_Key);
}
}
}
void CBOINCInternetFSHandler::ClearCache() {
m_Hash->BeginFind();
wxHashTable::Node* node = m_Hash->Next();
for(;;) {
if (node == NULL) return; // End of cache
MemFSHashObj* obj = (MemFSHashObj*)node->GetData();
// We must get next node before deleting this one
node = m_Hash->Next();
delete obj;
m_Hash->Delete(obj->m_Key);
}
}
void CBOINCInternetFSHandler::ShutDown() {
b_ShuttingDown = true;
#ifdef __WXMSW__
......
......@@ -31,6 +31,7 @@ public:
virtual bool CanOpen(const wxString& strLocation);
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& strLocation);
void UnchacheMissingItems();
void ClearCache();
void ShutDown();
protected:
......
......@@ -542,6 +542,7 @@ void CNoticeListCtrl::Clear() {
SetItemCount(0);
m_bComputerChanged = true;
UpdateUI();
Refresh();
}
......
......@@ -141,6 +141,8 @@ void CViewNotices::OnListRender(wxTimerEvent& WXUNUSED(event)) {
strLastMachineName = strNewMachineName;
m_FetchingNoticesText->Show();
m_NoNoticesText->Hide();
wxFileSystemHandler *internetFSHandler = wxGetApp().GetInternetFSHandler();
((CBOINCInternetFSHandler*)internetFSHandler)->ClearCache();
m_pHtmlListPane->Clear();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment