Widen the unique pointer a bit more.

This commit is contained in:
2025-04-18 05:20:26 -04:00
parent f4e70bfa75
commit f63c1209a9
4 changed files with 10 additions and 8 deletions

View File

@ -425,18 +425,16 @@ void Layout::removeWidget ()
updateCursor ();
}
void Layout::setWidget (Widget *widget)
void Layout::setWidget (std::unique_ptr< Widget > widget)
{
DBG_OBJ_ASSOC_CHILD (widget);
DBG_OBJ_ASSOC_CHILD (widget.get());
widgetAtPoint = NULL;
if (topLevel) {
topLevel.reset();
}
textZone->zoneFree ();
std::unique_ptr< Widget > widget_unique;
widget_unique.reset( widget );
addWidget (std::move( widget_unique ));
addWidget (std::move( widget ));
updateCursor ();

View File

@ -283,7 +283,7 @@ public:
lout::misc::ZoneAllocator *textZone;
void addWidget (std::unique_ptr< Widget > widget);
void setWidget (Widget *widget);
void setWidget (std::unique_ptr< Widget > widget);
void attachView (View *view);
void detachView (View *view);

View File

@ -348,7 +348,9 @@ void ComplexButtonResource::init (Widget *widget)
layout = new Layout (createPlatform (), false);
setLayout (layout);
DBG_OBJ_ASSOC_CHILD (layout);
layout->setWidget (widget);
std::unique_ptr< Widget > widget_unique;
widget_unique.reset( widget );
layout->setWidget (std::move( widget_unique ));
layout->connect (&layoutReceiver);
if (getEmbed ())

View File

@ -85,7 +85,9 @@ 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(dw);
std::unique_ptr< Widget > dw_unique;
dw_unique.reset( dw );
layout->setWidget(std::move( dw_unique ));
/* Set the page title with the bare filename (e.g. for images),
* HTML pages with a <TITLE> tag will overwrite it later */