1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 14:34:34 +00:00

fix crash on shutdown due to improper GL and buffer cleanup

thx Ninjakittyc4 for the pointers
This commit is contained in:
fgenesis 2025-06-03 04:36:44 +02:00
parent 95293a3366
commit e342d814d5
4 changed files with 18 additions and 10 deletions

View file

@ -31,6 +31,7 @@ BmpFont::BmpFont()
{
scale = 1;
loaded = false;
gltexid = 0;
overrideTexture = 0;
fontTopColor = Vector(1,1,1);
fontBtmColor = Vector(1,1,1);
@ -38,12 +39,17 @@ BmpFont::BmpFont()
BmpFont::~BmpFont()
{
delete font;
destroy();
delete font;
}
void BmpFont::destroy()
{
if(gltexid)
{
glDeleteTextures(1, &gltexid);
gltexid = 0;
}
if (loaded)
{
font->Destroy();
@ -55,18 +61,15 @@ void BmpFont::destroy()
void BmpFont::load(const std::string &file, float scale, bool loadTexture)
{
if (loaded)
font->Destroy();
destroy();
this->scale = scale;
GLuint id=0;
glGenTextures(1, &id);
glGenTextures(1, &gltexid);
if (!font->Create(file.c_str(), id, loadTexture))
if (!font->Create(file.c_str(), gltexid, loadTexture))
return;
loaded = true;
}

View file

@ -37,6 +37,7 @@ struct BmpFont
glfont::GLFont * const font;
float scale;
bool loaded;
unsigned gltexid;
Vector fontTopColor;
Vector fontBtmColor;

View file

@ -38,11 +38,14 @@ void DarkLayer::unloadDevice()
{
if (useFrameBuffer)
frameBuffer.unloadDevice();
else
if (texture)
{
if (texture)
glDeleteTextures(1, &texture);
glDeleteTextures(1, &texture);
texture = 0;
}
vbo.dropBuffer();
}
void DarkLayer::reloadDevice()

View file

@ -148,6 +148,7 @@ void GLFont::Destroy (void)
delete[] header.chars;
header.chars = NULL;
}
vbo.dropBuffer();
}
//*******************************************************************
void GLFont::GetTexSize (std::pair<int, int> *size) const