GRIM/EMI: Add nullptr checks to avoid segfaults on cleanup
This commit is contained in:
parent
b832fd43c1
commit
789da551fc
3 changed files with 10 additions and 6 deletions
|
@ -232,7 +232,7 @@ BitmapData::~BitmapData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapData::freeData() {
|
void BitmapData::freeData() {
|
||||||
if (!_keepData) {
|
if (!_keepData && _data) {
|
||||||
for (int i = 0; i < _numImages; ++i) {
|
for (int i = 0; i < _numImages; ++i) {
|
||||||
_data[i].free();
|
_data[i].free();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1218,9 +1218,10 @@ void GfxOpenGLS::selectTexture(const Texture *texture) {
|
||||||
|
|
||||||
void GfxOpenGLS::destroyTexture(Texture *texture) {
|
void GfxOpenGLS::destroyTexture(Texture *texture) {
|
||||||
GLuint *textures = static_cast<GLuint *>(texture->_texture);
|
GLuint *textures = static_cast<GLuint *>(texture->_texture);
|
||||||
glDeleteTextures(1, textures);
|
if (textures) {
|
||||||
|
glDeleteTextures(1, textures);
|
||||||
delete[] textures;
|
delete[] textures;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxOpenGLS::createBitmap(BitmapData *bitmap) {
|
void GfxOpenGLS::createBitmap(BitmapData *bitmap) {
|
||||||
|
|
|
@ -1247,8 +1247,11 @@ void GfxTinyGL::selectTexture(const Texture *texture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxTinyGL::destroyTexture(Texture *texture) {
|
void GfxTinyGL::destroyTexture(Texture *texture) {
|
||||||
tglDeleteTextures(1, (TGLuint *)texture->_texture);
|
TGLuint *textures = (TGLuint *)texture->_texture;
|
||||||
delete[] (TGLuint *)texture->_texture;
|
if (textures) {
|
||||||
|
tglDeleteTextures(1, textures);
|
||||||
|
delete[] textures;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxTinyGL::prepareMovieFrame(Graphics::Surface *frame) {
|
void GfxTinyGL::prepareMovieFrame(Graphics::Surface *frame) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue