Started plumbing out the ownership from layout.
It seems to not crash, yet.
This commit is contained in:
14
dw/layout.cc
14
dw/layout.cc
@ -327,10 +327,8 @@ Layout::~Layout ()
|
||||
if (bgImage)
|
||||
bgImage->unref ();
|
||||
if (topLevel) {
|
||||
detachWidget (topLevel);
|
||||
Widget *w = topLevel;
|
||||
topLevel = NULL;
|
||||
delete w;
|
||||
detachWidget (topLevel.get());
|
||||
topLevel.reset();
|
||||
}
|
||||
|
||||
delete queueResizeList;
|
||||
@ -379,7 +377,9 @@ void Layout::addWidget (Widget *widget)
|
||||
widget->stackingContextWidget = widget;
|
||||
}
|
||||
|
||||
topLevel = widget;
|
||||
std::unique_ptr< Widget > widget_unique;
|
||||
widget_unique.reset( widget );
|
||||
topLevel = std::move( widget_unique );
|
||||
widget->layout = this;
|
||||
widget->container = NULL;
|
||||
DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
|
||||
@ -432,9 +432,7 @@ void Layout::setWidget (Widget *widget)
|
||||
|
||||
widgetAtPoint = NULL;
|
||||
if (topLevel) {
|
||||
Widget *w = topLevel;
|
||||
topLevel = NULL;
|
||||
delete w;
|
||||
topLevel.reset();
|
||||
}
|
||||
textZone->zoneFree ();
|
||||
addWidget (widget);
|
||||
|
@ -158,7 +158,8 @@ private:
|
||||
|
||||
Platform *platform;
|
||||
View *view;
|
||||
Widget *topLevel, *widgetAtPoint;
|
||||
std::unique_ptr< Widget > topLevel;
|
||||
Widget *widgetAtPoint;
|
||||
lout::container::typed::Vector<Widget> *queueResizeList;
|
||||
|
||||
/* The state, which must be projected into the view. */
|
||||
|
@ -214,7 +214,7 @@ void Widget::drawInterruption (View *view, Rectangle *area,
|
||||
DrawingContext *context)
|
||||
{
|
||||
Rectangle thisArea;
|
||||
if (intersects (layout->topLevel, context->getToplevelArea (), &thisArea))
|
||||
if (intersects (layout->topLevel.get(), context->getToplevelArea (), &thisArea))
|
||||
draw (view, &thisArea, context);
|
||||
|
||||
context->addWidgetProcessedAsInterruption (this);
|
||||
|
Reference in New Issue
Block a user