Use shared pointers throughout when managing history with the ie backend, simplifying memory management. Also add more comments explaining how the history is managed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-01 10:01:45 +00:00
parent 60ec28290b
commit 3e7968c2da
2 changed files with 10 additions and 6 deletions

View File

@@ -373,12 +373,13 @@ bool wxWebViewIE::CanGoForward()
return false;
}
void wxWebViewIE::LoadHistoryItem(wxWebHistoryItem* item)
void wxWebViewIE::LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item)
{
int pos = -1;
for(unsigned int i = 0; i < m_historyList.size(); i++)
{
if(m_historyList[i].get() == item)
//We compare the actual pointers to find the correct item
if(m_historyList[i].get() == item.get())
pos = i;
}
wxASSERT_MSG(pos != m_historyList.size(), "invalid history item");
@@ -389,12 +390,12 @@ void wxWebViewIE::LoadHistoryItem(wxWebHistoryItem* item)
void wxWebViewIE::GoBack()
{
LoadHistoryItem(m_historyList[m_historyPosition - 1].get());
LoadHistoryItem(m_historyList[m_historyPosition - 1]);
}
void wxWebViewIE::GoForward()
{
LoadHistoryItem(m_historyList[m_historyPosition + 1].get());
LoadHistoryItem(m_historyList[m_historyPosition + 1]);
}
void wxWebViewIE::Stop()