Skip to content

Commit

Permalink
Fix double delete
Browse files Browse the repository at this point in the history
  • Loading branch information
gvoskuilen committed Jul 26, 2024
1 parent 7766fad commit d1246e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/sst/core/checkpointAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,10 @@ CheckpointAction::setCheckpoint()
generate_ = true;
}

SimTime_t
CheckpointAction::getNextCheckpointSimTime()
{
return next_sim_time_;
}

} // namespace SST
3 changes: 3 additions & 0 deletions src/sst/core/checkpointAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class CheckpointAction : public Action
/** Called by SyncManager to check whether a checkpoint should be generated */
void check();

/** Return next checkpoint time */
SimTime_t getNextCheckpointSimTime();

NotSerializable(SST::CheckpointAction);

private:
Expand Down
6 changes: 5 additions & 1 deletion src/sst/core/simulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ Simulation_impl::minPartToTC(SimTime_t cycles) const
Simulation_impl::~Simulation_impl()
{
// Clean up as best we can
delete checkpoint_action_;

// If checkpoint_action is triggered on sim time then it will
// be deleted when the timeVortex is deleted
if ( checkpoint_action_->getNextCheckpointSimTime() == 0 )
delete checkpoint_action_;

// Delete the timeVortex first. This will delete all events left
// in the queue, as well as the Sync, Exit and Clock objects.
Expand Down

0 comments on commit d1246e7

Please sign in to comment.