Skip to content

Commit

Permalink
destruction sequence for instances is now logical
Browse files Browse the repository at this point in the history
  • Loading branch information
DM8AT committed Aug 24, 2024
1 parent ff414f8 commit 38a1165
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/ObjectGL/OGL_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ OGL_Instance::OGL_Instance(float version, OGL_ProfileType profile)
//define the destructor
OGL_Instance::~OGL_Instance()
{
//loop over all bound bindables
for (size_t i = 0; i < this->bindables.size(); ++i)
{
//delete the bindable
delete this->bindables[i];
}

//loop over all bound windows
for (size_t i = 0; i < this->windows.size(); ++i)
{
//delete the window
delete this->windows[i];
}
//store the ID of the instance
size_t id = -1;
//loop over all instances
Expand Down Expand Up @@ -116,21 +129,6 @@ OGL_Instance::~OGL_Instance()
//set the current instance to 0
oglCurrentInstance = 0;
}

//loop over all bound bindables
for (size_t i = 0; i < this->bindables.size(); ++i)
{
//delete the bindable
delete this->bindables[i];
}

//loop over all bound windows
for (size_t i = 0; i < this->windows.size(); ++i)
{
//delete the window
delete this->windows[i];
}

//check if instances remain
if (oglAllInstances.size() == 0)
{
Expand Down

0 comments on commit 38a1165

Please sign in to comment.