]> git.saurik.com Git - wxWidgets.git/commitdiff
Use shared pointers throughout when managing history with the ie backend, simplifying...
authorSteve Lamerton <steve.lamerton@gmail.com>
Fri, 1 Jul 2011 10:01:45 +0000 (10:01 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Fri, 1 Jul 2011 10:01:45 +0000 (10:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/webview_ie.h
src/msw/webview_ie.cpp

index 608f4349cfa1f27ef45bbba7253975bf31b87c7e..666e17b32b6b6450688eef0a4786a024c29f58ea 100644 (file)
@@ -58,7 +58,7 @@ public:
            const wxString& name = wxWebViewNameStr);
 
     virtual void LoadUrl(const wxString& url);
-    virtual void LoadHistoryItem(wxWebHistoryItem* item);
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
 
     virtual bool CanGoForward();
     virtual bool CanGoBack();
@@ -124,7 +124,10 @@ private:
      *  Busy property is false but should be true.
      */
     bool m_isBusy;
-    //We manage our own history
+    //We manage our own history, the history list contains the history items 
+    //which are added as documentcomplete events arrive, unless we are loading
+    //an item from the history. The position is stored as an int, and reflects
+    //where we are in the history list.
     wxVector<wxSharedPtr<wxWebHistoryItem> > m_historyList;
     int m_historyPosition;
     bool m_historyLoadingFromList;
index 711932390ed30987af56df2a62338a0dadaf1731..17e6fa308eac7964640512be0a93a3848c91272a 100644 (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()