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)
|
if (bgImage)
|
||||||
bgImage->unref ();
|
bgImage->unref ();
|
||||||
if (topLevel) {
|
if (topLevel) {
|
||||||
detachWidget (topLevel);
|
detachWidget (topLevel.get());
|
||||||
Widget *w = topLevel;
|
topLevel.reset();
|
||||||
topLevel = NULL;
|
|
||||||
delete w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete queueResizeList;
|
delete queueResizeList;
|
||||||
@ -379,7 +377,9 @@ void Layout::addWidget (Widget *widget)
|
|||||||
widget->stackingContextWidget = 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->layout = this;
|
||||||
widget->container = NULL;
|
widget->container = NULL;
|
||||||
DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
|
DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
|
||||||
@ -432,9 +432,7 @@ void Layout::setWidget (Widget *widget)
|
|||||||
|
|
||||||
widgetAtPoint = NULL;
|
widgetAtPoint = NULL;
|
||||||
if (topLevel) {
|
if (topLevel) {
|
||||||
Widget *w = topLevel;
|
topLevel.reset();
|
||||||
topLevel = NULL;
|
|
||||||
delete w;
|
|
||||||
}
|
}
|
||||||
textZone->zoneFree ();
|
textZone->zoneFree ();
|
||||||
addWidget (widget);
|
addWidget (widget);
|
||||||
|
|||||||
@ -158,7 +158,8 @@ private:
|
|||||||
|
|
||||||
Platform *platform;
|
Platform *platform;
|
||||||
View *view;
|
View *view;
|
||||||
Widget *topLevel, *widgetAtPoint;
|
std::unique_ptr< Widget > topLevel;
|
||||||
|
Widget *widgetAtPoint;
|
||||||
lout::container::typed::Vector<Widget> *queueResizeList;
|
lout::container::typed::Vector<Widget> *queueResizeList;
|
||||||
|
|
||||||
/* The state, which must be projected into the view. */
|
/* The state, which must be projected into the view. */
|
||||||
|
|||||||
@ -214,7 +214,7 @@ void Widget::drawInterruption (View *view, Rectangle *area,
|
|||||||
DrawingContext *context)
|
DrawingContext *context)
|
||||||
{
|
{
|
||||||
Rectangle thisArea;
|
Rectangle thisArea;
|
||||||
if (intersects (layout->topLevel, context->getToplevelArea (), &thisArea))
|
if (intersects (layout->topLevel.get(), context->getToplevelArea (), &thisArea))
|
||||||
draw (view, &thisArea, context);
|
draw (view, &thisArea, context);
|
||||||
|
|
||||||
context->addWidgetProcessedAsInterruption (this);
|
context->addWidgetProcessedAsInterruption (this);
|
||||||
|
|||||||
Reference in New Issue
Block a user