From f567c9c40c08f5aaee47529802bf598b8472ce4a Mon Sep 17 00:00:00 2001 From: Philipp A Hartmann Date: Sun, 20 May 2018 17:26:27 +0200 Subject: [PATCH] sc_process: only delete processes within kernel context --- src/sysc/kernel/sc_process.cpp | 4 ++-- src/sysc/kernel/sc_simcontext.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sysc/kernel/sc_process.cpp b/src/sysc/kernel/sc_process.cpp index c549e16be..bc3c12ad1 100644 --- a/src/sysc/kernel/sc_process.cpp +++ b/src/sysc/kernel/sc_process.cpp @@ -172,7 +172,7 @@ void sc_process_b::delete_process() // Immediate deletion: - if ( this != sc_get_current_process_b() ) + if ( NULL == sc_get_current_process_b() ) { delete this; } @@ -182,7 +182,7 @@ void sc_process_b::delete_process() else { - m_references_n = 1; + m_references_n = 1; detach(); simcontext()->mark_to_collect_process( this ); } diff --git a/src/sysc/kernel/sc_simcontext.cpp b/src/sysc/kernel/sc_simcontext.cpp index 528913749..7b33216bd 100644 --- a/src/sysc/kernel/sc_simcontext.cpp +++ b/src/sysc/kernel/sc_simcontext.cpp @@ -600,6 +600,7 @@ sc_simcontext::crunch( bool once ) // by '*m_error'. out: this->reset_curr_proc(); + do_collect_processes(); if( m_error ) throw *m_error; // re-throw propagated error }