delete selected crash bug fix

This commit is contained in:
Rafael 2016-04-13 00:41:06 +02:00
parent b98d9f9e57
commit 6ff8de8972

View file

@ -308,7 +308,9 @@ void ProfileInterface::savegameDeleted_f(QWidget *sgdWidget_)
SavegameWidget *sgdWidget = (SavegameWidget*)sgdWidget_; SavegameWidget *sgdWidget = (SavegameWidget*)sgdWidget_;
SavegameData *savegame = sgdWidget->getSavegame(); SavegameData *savegame = sgdWidget->getSavegame();
if (sgdWidget->isSelected()) { sgdWidget->setSelected(false); } if (sgdWidget->isSelected()) { sgdWidget->setSelected(false); }
widgets.remove(sgdWidget);
sgdWidget->close(); sgdWidget->close();
sgdWidget->deleteLater();
savegames.removeAll(savegame); savegames.removeAll(savegame);
delete savegame; delete savegame;
} }
@ -324,6 +326,8 @@ void ProfileInterface::pictureDeleted_f(QWidget *picWidget_)
SnapmaticPicture *picture = picWidget->getPicture(); SnapmaticPicture *picture = picWidget->getPicture();
if (picWidget->isSelected()) { picWidget->setSelected(false); } if (picWidget->isSelected()) { picWidget->setSelected(false); }
picWidget->close(); picWidget->close();
widgets.remove(picWidget);
picWidget->deleteLater();
pictures.removeAll(picture); pictures.removeAll(picture);
delete picture; delete picture;
} }