From f4281aea39a9c17cb491309aecfadc182f00f7d4a4a37aee453d2b4f15839987 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 9 Aug 2025 17:55:58 -0400 Subject: [PATCH] Another simple ownership case. --- src/form.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/form.cc b/src/form.cc index a4f5d31..38bf61b 100644 --- a/src/form.cc +++ b/src/form.cc @@ -89,7 +89,7 @@ public: //BUG: for now everything is public DilloHtmlMethod method; DilloHtmlMethod get_method() const override { return method; } - DilloUrl *action; + std::unique_ptr< DilloUrl > action; DilloHtmlEnc content_type; DilloHtmlEnc get_content_type() const override { return content_type; } char *submit_charset; @@ -127,7 +127,6 @@ private: public: DilloHtmlReceiver (DilloHtmlFormImpl* form2) { form = form2; } - ~DilloHtmlReceiver () { } private: void activate (Resource *resource); @@ -971,7 +970,7 @@ DilloHtmlFormImpl::DilloHtmlFormImpl (DilloHtml *html2, { html = html2; method = method2; - action = a_Url_dup(action2).release(); + action = a_Url_dup(action2); content_type = content_type2; submit_charset = dStrdup(charset); num_entry_fields = 0; @@ -985,7 +984,6 @@ DilloHtmlFormImpl::DilloHtmlFormImpl (DilloHtml *html2, */ DilloHtmlFormImpl::~DilloHtmlFormImpl () { - delete action; dFree(submit_charset); inputs.clear(); } @@ -1064,7 +1062,7 @@ std::unique_ptr< DilloUrl > DilloHtmlFormImpl::buildQueryUrl(DilloHtmlInput *act if (queryStr.has_value()) { auto DataStr= queryStr.value(); /* action was previously resolved against base URL */ - char *action_str = dStrdup(URL_STR(action)); + char *action_str = dStrdup(URL_STR(action.get())); if (method == DILLO_HTML_METHOD_POST) { new_url = a_Url_new(action_str, NULL); @@ -1594,7 +1592,7 @@ void DilloHtmlReceiver::enter (Resource *resource) ((input->type == DILLO_HTML_INPUT_PASSWORD) || (input->type == DILLO_HTML_INPUT_TEXT)))) { /* The control can submit form. Show action URL. */ - msg = URL_STR(form->action); + msg = URL_STR(form->action.get()); } a_UIcmd_set_msg(html->bw, "%s", msg); }