From 14fc3937756d304d096df0d170d03cb0b7f9bea1 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 12 Jul 2021 08:32:37 +0200 Subject: [PATCH] more error checks --- src/layouts/QskGridBox.cpp | 2 +- src/layouts/QskLinearBox.cpp | 2 +- src/layouts/QskStackBox.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/QskGridBox.cpp b/src/layouts/QskGridBox.cpp index 6bb4d914..5dbe302a 100644 --- a/src/layouts/QskGridBox.cpp +++ b/src/layouts/QskGridBox.cpp @@ -130,7 +130,7 @@ int QskGridBox::addItem( QQuickItem* item, int QskGridBox::addItem( QQuickItem* item, int row, int column, int rowSpan, int columnSpan ) { - if ( item == nullptr || row < 0 || column < 0 ) + if ( item == nullptr || item == this || row < 0 || column < 0 ) return -1; if ( qskIsTransparentForPositioner( item ) ) diff --git a/src/layouts/QskLinearBox.cpp b/src/layouts/QskLinearBox.cpp index 9c965fa3..5cd1ecc2 100644 --- a/src/layouts/QskLinearBox.cpp +++ b/src/layouts/QskLinearBox.cpp @@ -393,7 +393,7 @@ int QskLinearBox::insertItem( int QskLinearBox::insertItem( int index, QQuickItem* item ) { - if ( item == nullptr ) + if ( item == nullptr || item == this ) return -1; if ( qskIsTransparentForPositioner( item ) ) diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index d7f93657..dbec8c2b 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -185,7 +185,7 @@ void QskStackBox::addItem( QQuickItem* item, Qt::Alignment alignment ) void QskStackBox::insertItem( int index, QQuickItem* item ) { - if ( item == nullptr ) + if ( item == nullptr || item == this ) return; reparentItem( item );