Skip to content

Commit

Permalink
call free_instance on destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
markaren committed Oct 3, 2024
1 parent 420d0be commit 932a646
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/fmi4cpp/fmu_instance_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,13 @@ class fmu_instance_base : public virtual fmu_instance<model_description>
return library_->reset(c_);
}

bool terminate() override
{
return terminate(true);
}

bool terminate(bool freeInstance)
bool terminate()
{
if (!this->terminated_) {
this->terminated_ = true;
if (!library_->terminate(c_)) {
return false;
}
this->free_instance();
}
return true;
}
Expand Down Expand Up @@ -257,6 +251,7 @@ class fmu_instance_base : public virtual fmu_instance<model_description>
~fmu_instance_base()
{
terminate();
free_instance();
}
};

Expand Down

0 comments on commit 932a646

Please sign in to comment.