diff --git a/src/form.cc b/src/form.cc index b775a58..8380756 100644 --- a/src/form.cc +++ b/src/form.cc @@ -994,7 +994,7 @@ void DilloHtmlFormImpl::eventHandler(Resource *resource, EventButton *event) { _MSG("DilloHtmlFormImpl::eventHandler\n"); if (event && (event->button == 3)) { - a_UIcmd_form_popup(html->bw, html->page_url, this, showing_hiddens); + a_UIcmd_form_popup(html->bw, html->page_url.get(), this, showing_hiddens); } else { auto input = getInput(resource); if (input) { diff --git a/src/html.cc b/src/html.cc index 7b3f8d0..75577f1 100644 --- a/src/html.cc +++ b/src/html.cc @@ -445,7 +445,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, { /* Init main variables */ bw = p_bw; - page_url = a_Url_dup(url).release(); + page_url = a_Url_dup(url); base_url = a_Url_dup(url).release(); dw = NULL; @@ -473,7 +473,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, DocType = DT_NONE; /* assume Tag Soup 0.0! :-) */ DocTypeVersion = 0.0f; - styleEngine = std::make_unique< StyleEngine >(HT2LT (this), page_url, base_url, bw->zoom); + styleEngine = std::make_unique< StyleEngine >(HT2LT (this), page_url.get(), base_url, bw->zoom); stack = new misc::SimpleVector (16); stack->increase(); @@ -548,7 +548,6 @@ DilloHtml::~DilloHtml() a_Bw_remove_doc(bw, this); - delete page_url; delete base_url; } @@ -689,7 +688,7 @@ void DilloHtml::loadImages (const DilloUrl *pattern) * If the possible patterns become more complex, it might be good to have * the caller supply the requester instead. */ - const DilloUrl *requester = pattern ? NULL : this->page_url; + const DilloUrl *requester = pattern ? NULL : this->page_url.get(); for (int i = 0; i < images.size(); i++) { DilloHtmlImage *hi = images.at(i).get(); @@ -749,14 +748,14 @@ bool DilloHtml::HtmlLinkReceiver::press (Widget *widget, int link, int img, linkurl = html->links.at(link).get(); const bool_t loaded_img = (html->images.at(img)->image == NULL); a_UIcmd_image_popup(bw, html->images.at(img)->url.get(), loaded_img, - html->page_url, linkurl); + html->page_url.get(), linkurl); ret = true; } else { if (link == -1) { a_UIcmd_page_popup(bw, bw->num_page_bugs != 0, &html->cssUrls); ret = true; } else { - a_UIcmd_link_popup(bw, html->links.at(link).get(), html->page_url); + a_UIcmd_link_popup(bw, html->links.at(link).get(), html->page_url.get()); ret = true; } } @@ -1689,7 +1688,7 @@ static void Html_tag_close_title(DilloHtml *html) if (!title || title[0] == '\0') return; a_UIcmd_set_page_title(html->bw, title); - a_History_set_title_by_url(html->page_url, title); + a_History_set_title_by_url(html->page_url.get(), title); } } @@ -2131,7 +2130,7 @@ std::shared_ptr< DilloImage > a_Html_image_new(DilloHtml *html, const char *tag, !dStrAsciiCasecmp(URL_SCHEME(hi->url.get()), "data") || (a_Capi_get_flags_with_redirection(hi->url.get()) & CAPI_IsCached); - if (load_now && Html_load_image(html->bw, hi->url.get(), html->page_url, image)) { + if (load_now && Html_load_image(html->bw, hi->url.get(), html->page_url.get(), image)) { // hi->image is NULL if dillo tries to load the image immediately hi->image = nullptr; } else { @@ -3046,7 +3045,7 @@ static int Html_tag_pre_excludes(DilloHtml *html, int tag_idx) */ static void Html_update_content_type(DilloHtml *html, const char *content) { - const char *new_content = a_Capi_set_content_type(html->page_url, content, + const char *new_content = a_Capi_set_content_type(html->page_url.get(), content, "meta"); /* Cannot ask cache whether the content type was changed, as * this code in another bw might have already changed it for us. @@ -3227,7 +3226,7 @@ void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url) } else { /* Fill a Web structure for the cache query */ int ClientKey; - DilloWeb *Web = a_Web_new(html->bw, url, html->page_url); + DilloWeb *Web = a_Web_new(html->bw, url, html->page_url.get()); Web->flags |= WEB_Stylesheet; if ((ClientKey = a_Capi_open_url(Web, Html_css_load_callback, NULL))) { ++html->bw->NumPendingStyleSheets; diff --git a/src/html_common.hh b/src/html_common.hh index 99e9572..2854468 100644 --- a/src/html_common.hh +++ b/src/html_common.hh @@ -167,7 +167,8 @@ private: public: //BUG: for now everything is public BrowserWindow *bw; - DilloUrl *page_url, *base_url; + std::unique_ptr< DilloUrl > page_url; + DilloUrl *base_url; dw::core::Widget *dw; /* this is duplicated in the stack */ /* -------------------------------------------------------------------*/