From e2e9170dfa8ddcd9bce8f3376619b8993537c46c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 17 Jun 2023 18:52:57 -0400 Subject: [PATCH] protect a couple more fixes from segfaults from errors in derived classes --- src/RIGID/fix_rigid.cpp | 2 +- src/fix_langevin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index df49d84439..44427d2914 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -610,7 +610,7 @@ FixRigid::~FixRigid() { // 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 random; delete[] inpfile; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 0e083ce012..35bffb24fa 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -203,7 +203,7 @@ FixLangevin::~FixLangevin() if (gjfflag) { memory->destroy(franprev); memory->destroy(lv); - atom->delete_callback(id, Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); } }