Html dtor simplified more.
This commit is contained in:
17
src/html.cc
17
src/html.cc
@ -550,14 +550,6 @@ DilloHtml::~DilloHtml()
|
||||
|
||||
delete page_url;
|
||||
delete base_url;
|
||||
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
DilloHtmlImage *img = images.at(i);
|
||||
img->url.reset(); // Was: delete img->url;
|
||||
img->image.reset(); // Was: a_Image_unref(img->image);
|
||||
delete img;
|
||||
}
|
||||
images.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -700,7 +692,7 @@ void DilloHtml::loadImages (const DilloUrl *pattern)
|
||||
const DilloUrl *requester = pattern ? NULL : this->page_url;
|
||||
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
DilloHtmlImage *hi = images.at(i);
|
||||
DilloHtmlImage *hi = images.at(i).get();
|
||||
|
||||
if (hi->image) {
|
||||
assert(hi->url);
|
||||
@ -2130,9 +2122,10 @@ std::shared_ptr< DilloImage > a_Html_image_new(DilloHtml *html, const char *tag,
|
||||
if (HT2TB(html)->getFgColor())
|
||||
image->fg_color = HT2TB(html)->getFgColor()->getColor();
|
||||
|
||||
DilloHtmlImage *hi = new DilloHtmlImage{};
|
||||
hi->url = std::move( url );
|
||||
html->images.push_back(hi);
|
||||
auto hi_ = std::make_unique< DilloHtmlImage >();
|
||||
hi_->url = std::move( url );
|
||||
html->images.push_back( std::move( hi_ ) );
|
||||
auto *hi = html->images.back().get();
|
||||
|
||||
load_now = prefs.load_images ||
|
||||
!dStrAsciiCasecmp(URL_SCHEME(hi->url.get()), "data") ||
|
||||
|
@ -222,7 +222,7 @@ public: //BUG: for now everything is public
|
||||
std::vector< std::unique_ptr< DilloHtmlForm > > forms;
|
||||
std::vector< std::shared_ptr< DilloHtmlInput > > inputs_outside_form;
|
||||
std::vector< std::unique_ptr< DilloUrl > > links;
|
||||
std::vector< DilloHtmlImage * > images;
|
||||
std::vector< std::unique_ptr< DilloHtmlImage > > images;
|
||||
dw::ImageMapsList maps;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user