Revert "This adds some resource-ownership tracking."

This reverts commit fad3dbc39a.
This commit is contained in:
2025-04-16 04:16:04 -04:00
parent d001d2609b
commit 80f980a2e1
11 changed files with 43 additions and 47 deletions

View File

@ -945,8 +945,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
if (inp_type != DILLO_HTML_INPUT_UNKNOWN) {
/* Render the button */
std::unique_ptr< Widget > page;
Widget *page_p;
Widget *page;
Embed *embed;
const char *attrbuf;
char *name, *value;
@ -960,18 +959,17 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
/* We used to have Textblock (prefs.limit_text_width, ...) here,
* but it caused 100% CPU usage.
*/
page = std::make_unique< Textblock > (false, true);
page = new Textblock (false, true);
page->setStyle (html->backgroundStyle ());
page_p= page.get();
ResourceFactory *factory = HT2LT(html)->getResourceFactory();
Resource *resource = factory->createComplexButtonResource(std::move( page ), true);
Resource *resource = factory->createComplexButtonResource(page, true);
embed = new Embed(resource);
// a_Dw_button_set_sensitive (DW_BUTTON (button), FALSE);
HT2TB(html)->addWidget (embed, html->backgroundStyle ());
S_TOP(html)->textblock = html->dw = page_p;
S_TOP(html)->textblock = html->dw = page;
value = a_Html_get_attr_wdef(html, tag, tagsize, "value", NULL);
name = a_Html_get_attr_wdef(html, tag, tagsize, "name", NULL);
@ -2044,12 +2042,11 @@ static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize)
// At this point, we know that Image->ir represents an image
// widget. Notice that the order of the casts matters, because
// of multiple inheritance.
std::unique_ptr< dw::Image > dwi;
dwi.reset( reinterpret_cast< dw::Image *>( (dw::core::ImgRenderer*)Image->img_rndr ) );
dw::Image *dwi = (dw::Image*)(dw::core::ImgRenderer*)Image->img_rndr;
dwi->setStyle (html->backgroundStyle ());
ResourceFactory *factory = HT2LT(html)->getResourceFactory();
ComplexButtonResource *complex_b_r =
factory->createComplexButtonResource(std::move( dwi ), false);
factory->createComplexButtonResource(dwi, false);
button = new Embed(complex_b_r);
HT2TB(html)->addWidget (button, html->style ());
}

View File

@ -85,7 +85,7 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web,
dw->setStyle (styleEngine.style (Web->bw));
/* This method frees the old dw if any */
layout->setWidget(std::unique_ptr< Widget >{ dw });
layout->setWidget(dw);
/* Set the page title with the bare filename (e.g. for images),
* HTML pages with a <TITLE> tag will overwrite it later */