Fix a race condition when the main window is being destructed.
During the destructor of QWidget, we delete the layout. If the layout is not set to 0 afterwards, a check on the layout might turn true, but any access will end with a segfault. Reviewed-by: João Abecasis (cherry picked from commit abc5a632942c23496d75c49b3b0b4a674cdafdf8)
This commit is contained in:
parent
e7de0c2e12
commit
e27baeff28
@ -1588,6 +1588,7 @@ QWidget::~QWidget()
|
||||
|
||||
// delete layout while we still are a valid widget
|
||||
delete d->layout;
|
||||
d->layout = 0;
|
||||
// Remove myself from focus list
|
||||
|
||||
Q_ASSERT(d->focus_next->d_func()->focus_prev == this);
|
||||
|
@ -152,7 +152,8 @@ void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
|
||||
void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget)
|
||||
{
|
||||
QMainWindowLayout *mlayout = qobject_cast<QMainWindowLayout*> (widget->window()->layout());
|
||||
mlayout->updateUnifiedToolbarOffset();
|
||||
if (mlayout)
|
||||
mlayout->updateUnifiedToolbarOffset();
|
||||
}
|
||||
|
||||
void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
|
||||
|
Loading…
Reference in New Issue
Block a user