X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be103d4a3d79b507fa514587d792e8bdcfa89a7c..ea14492351395f1dcea060e8db0860f865b92658:/src/common/url.cpp diff --git a/src/common/url.cpp b/src/common/url.cpp index 918923287a..383a5d088b 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -65,9 +65,15 @@ wxURL::wxURL(const wxString& url) : wxURI(url) ParseURL(); } -wxURL::wxURL(const wxURI& url) : wxURI(url) +wxURL::wxURL(const wxURI& uri) : wxURI(uri) { - Init(url.BuildURI()); + Init(uri.BuildURI()); + ParseURL(); +} + +wxURL::wxURL(const wxURL& url) : wxURI(url) +{ + Init(url.GetURL()); ParseURL(); } @@ -102,18 +108,39 @@ void wxURL::Init(const wxString& url) // Assignment // -------------------------------------------------------------- -wxURL& wxURL::operator = (const wxURI& url) +wxURL& wxURL::operator = (const wxString& url) { wxURI::operator = (url); - Init(url.BuildURI()); + Free(); + Init(url); ParseURL(); + return *this; } -wxURL& wxURL::operator = (const wxString& url) + +wxURL& wxURL::operator = (const wxURI& uri) { - wxURI::operator = (url); - Init(url); - ParseURL(); + if (&uri != this) + { + wxURI::operator = (uri); + Free(); + Init(uri.BuildURI()); + ParseURL(); + } + + return *this; +} + +wxURL& wxURL::operator = (const wxURL& url) +{ + if (&url != this) + { + wxURI::operator = (url); + Free(); + Init(url.GetURL()); + ParseURL(); + } + return *this; } @@ -195,7 +222,7 @@ void wxURL::CleanData() } } -wxURL::~wxURL() +void wxURL::Free() { CleanData(); #if wxUSE_PROTOCOL_HTTP @@ -207,6 +234,11 @@ wxURL::~wxURL() #endif } +wxURL::~wxURL() +{ + Free(); +} + // -------------------------------------------------------------- // FetchProtocol // --------------------------------------------------------------