I->erasefromParent outside if else