]> git.saurik.com Git - wxWidgets.git/commitdiff
Readd wxStringList::Add when wxUSE_STL=1, for compatibility with
authorMattia Barbon <mbarbon@cpan.org>
Sat, 12 Jul 2003 20:34:34 +0000 (20:34 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Sat, 12 Jul 2003 20:34:34 +0000 (20:34 +0000)
wxUSE_STL=0. Fixed wxPathList double-free reported by Devid Elliot.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21926 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/list.h
src/common/filefn.cpp

index 247b602e34e72b1b4cfa3d6859c3b0e3b42cd8bc..43316ca914f505fa91c8d4f54c7d26e2efded352 100644 (file)
@@ -1053,6 +1053,20 @@ WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLEXPORT);
 class WXDLLEXPORT wxStringList : public wxStringListBase
 {
 public:
+    compatibility_iterator Append(wxChar* s)
+        { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); }
+    compatibility_iterator Insert(wxChar* s)
+        { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); }
+    compatibility_iterator Insert(size_t pos, wxChar* s)
+    {
+        wxString tmp = s;
+        delete[] s;
+        return wxStringListBase::Insert(pos, tmp);
+    }
+    compatibility_iterator Add(const wxChar* s)
+        { push_back(s); return GetLast(); }
+    compatibility_iterator Prepend(const wxChar* s)
+        { push_front(s); return GetFirst(); }
 };
 
 #endif // wxUSE_STL
index 3ccac13183f3116f5c8a6d57d8161943a225b963..41e11eb45cdf69320c2b8f8f544c4b202fff61f6 100644 (file)
@@ -255,7 +255,7 @@ static inline wxChar* MYcopystring(const wxChar* s)
 
 void wxPathList::Add (const wxString& path)
 {
-    wxStringList::Append (WXSTRINGCAST path);
+    wxStringList::Add (WXSTRINGCAST path);
 }
 
 // Add paths e.g. from the PATH environment variable