Skip to content

Commit

Permalink
Deleteing a NetCon when the source Point_process is unlocated could c…
Browse files Browse the repository at this point in the history
…ause

a memory error in python due to hoc_execerror that could not be handled.
I.e That can happen on Python cleanup on exit if a section was deleted
prior to deleting a NetCon when it points to a source that was located
in the section.
  • Loading branch information
nrnhines committed Nov 6, 2017
1 parent 31c795d commit 9fc7197
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nrncvode/netcvode.cpp
Expand Up @@ -94,6 +94,7 @@ void _nrn_free_watch(Datum*, int, int);
extern int hoc_araypt(Symbol*, int);
extern int hoc_stacktype();
extern Point_process* ob2pntproc(Object*);
extern Point_process* ob2pntproc_0(Object*);
void nrn_use_daspk(int);
extern int nrn_use_daspk_;
int linmod_extra_eqn_count();
Expand Down Expand Up @@ -4918,7 +4919,8 @@ PreSyn::~PreSyn() {
nrn_notify_pointer_disconnect(this);
#endif
if (!thvar_) {
Point_process* pnt = ob2pntproc(osrc_);
// even if the point process section was deleted earlier
Point_process* pnt = ob2pntproc_0(osrc_);
if (pnt) {
pnt->presyn_ = nil;
}
Expand Down

0 comments on commit 9fc7197

Please sign in to comment.