I try to remove widgets from a specified row in a QGridLayout like this:
QGridLayout
void delete_grid_row(QGridLayout *layout, int row) { if (!layout ||
The QGridLayout itself is managing the QLayoutItem's. I believe the moment you call removeWidget the item will be deleted. Thus you have an invalid pointer at that point. Attempting to do anything with it, not just delete, will fail.
QLayoutItem
removeWidget
delete
Thus, just don't delete it, you'll be fine.