avoid segfault on deleting callback when there is an error in the constructor or a derived class
This commit is contained in:
@ -143,7 +143,8 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixQEq::~FixQEq()
|
||||
{
|
||||
// unregister callbacks to this fix from Atom class
|
||||
atom->delete_callback(id,Atom::GROW);
|
||||
|
||||
if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW);
|
||||
|
||||
memory->destroy(s_hist);
|
||||
memory->destroy(t_hist);
|
||||
|
||||
@ -481,7 +481,7 @@ FixRigidSmall::~FixRigidSmall()
|
||||
{
|
||||
// unregister callbacks to this fix from Atom class
|
||||
|
||||
atom->delete_callback(id,Atom::GROW);
|
||||
if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW);
|
||||
|
||||
// delete locally stored arrays
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ FixShake::~FixShake()
|
||||
|
||||
// unregister callbacks to this fix from Atom class
|
||||
|
||||
atom->delete_callback(id,Atom::GROW);
|
||||
if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW);
|
||||
|
||||
// set bond_type and angle_type back to positive for SHAKE clusters
|
||||
// must set for all SHAKE bonds and angles stored by each atom
|
||||
|
||||
Reference in New Issue
Block a user