forked from lijiext/lammps
Fixed proper deletion of fixes if fix is NULL
This commit is contained in:
parent
6d0a228624
commit
23e283f135
|
@ -110,7 +110,7 @@ Modify::~Modify()
|
||||||
// delete all fixes
|
// delete all fixes
|
||||||
// do it via delete_fix() so callbacks in Atom are also updated correctly
|
// do it via delete_fix() so callbacks in Atom are also updated correctly
|
||||||
|
|
||||||
while (nfix) delete_fix(fix[0]->id);
|
while (nfix) delete_fix(0);
|
||||||
memory->sfree(fix);
|
memory->sfree(fix);
|
||||||
memory->destroy(fmask);
|
memory->destroy(fmask);
|
||||||
|
|
||||||
|
@ -944,7 +944,13 @@ void Modify::delete_fix(const char *id)
|
||||||
{
|
{
|
||||||
int ifix = find_fix(id);
|
int ifix = find_fix(id);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find fix ID to delete");
|
if (ifix < 0) error->all(FLERR,"Could not find fix ID to delete");
|
||||||
delete fix[ifix];
|
delete_fix(ifix);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Modify::delete_fix(int ifix)
|
||||||
|
{
|
||||||
|
if(fix[ifix])
|
||||||
|
delete fix[ifix];
|
||||||
atom->update_callback(ifix);
|
atom->update_callback(ifix);
|
||||||
|
|
||||||
// move other Fixes and fmask down in list one slot
|
// move other Fixes and fmask down in list one slot
|
||||||
|
|
|
@ -95,6 +95,7 @@ class Modify : protected Pointers {
|
||||||
void add_fix(int, char **, int trysuffix=1);
|
void add_fix(int, char **, int trysuffix=1);
|
||||||
void modify_fix(int, char **);
|
void modify_fix(int, char **);
|
||||||
void delete_fix(const char *);
|
void delete_fix(const char *);
|
||||||
|
void delete_fix(int);
|
||||||
int find_fix(const char *);
|
int find_fix(const char *);
|
||||||
int find_fix_by_style(const char *);
|
int find_fix_by_style(const char *);
|
||||||
int check_package(const char *);
|
int check_package(const char *);
|
||||||
|
|
Loading…
Reference in New Issue