I have a bullet class that I want to delete upon hitting anything but if it hits an enemy, I want it to delete the enemy as well. It was working on my desktop but upon switching to my laptop, it starts crashing whenever it removes. Currently my scene is outside in a different class in Dialog.cpp
here's my code:
bullet.cpp
void bullet::DoCollision()
{
QList<QGraphicsItem *> list = collidingItems() ;
foreach(QGraphicsItem * i , list)
{
if (i->type() == 3)
{
QGraphicsItem * item= i;
delete item;
qDebug() << "bye";
}
}
m_FireTimer->stop();
delete this;
}