• Jan Arve Saether's avatar
    Do not crash when deleting a layout · cf6f7de3
    Jan Arve Saether authored
    
    onItemVisibleChanged() was in some cases called after the dtor of
    QQuickGridLayoutBase was called.
    
    After having called the dtor of QQuickGridLayoutBase it would
    continue to call the dtors of its base classes until it entered the
    dtor of QQuickItem.  In QQuickItem it would call setParentItem(0) on
    all its child items. This caused the item to become visible again,
    thus it would emit visibleChanged() and finally invoke
    QQuickGridLayoutBase::onItemVisibleChanged() which lead to the crash
    (while trying to call the virtual invalidate())
    
    The fix is to do an early return if we know that the layout is
    in the destruction phase.
    isReady() will return only true *after* the component is completed,
    and before the component is destructing.
    
    Task-number: QTBUG-31276
    Change-Id: I191e348278e3d052c109bffb92a1ccd9326859bd
    Reviewed-by: default avatarJens Bache-Wiig <jens.bache-wiig@digia.com>
    cf6f7de3