diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-04-18 16:52:19 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-04-19 13:25:14 +0000 |
commit | cdb7e81572df726486fc0bdc648f732b797c7f84 (patch) | |
tree | 726bc8dbcaee46d01cd4eb085405800d579d60c8 /src/widgets/graphicsview | |
parent | f368cd88687643d565763602721cae6e9602e34d (diff) |
Fix UB in QLayout::childEvent
We can't just static_cast a child to QLayout, because the child might
not be a QLayout, and even if it was, we might be called from the
QObject destructor so we would not be a layout anymore.
Instead we can just qobject_cast the deleted object to a QLayout and
remove it from the layout with removeItem.
This would not take in account the case where we would be called because
the QLayout gets destroyed, so we handle this case from ~QLayout by
removing ourself from the parent.
Note that the comment in ~QLayout was wrong, as the layout gets destroyed
explicitly from ~QWidget, not from ~QObject.
Change-Id: I49c6f17a76f207b9d750b6e5d987469498b96b31
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/graphicsview')
0 files changed, 0 insertions, 0 deletions