GRIM: Fix a memory leak with tinygl bitmaps. Fixes #580
This commit is contained in:
parent
1d765d28b1
commit
7afd163b6e
2 changed files with 5 additions and 1 deletions
|
@ -240,10 +240,10 @@ BitmapData::BitmapData() :
|
||||||
|
|
||||||
BitmapData::~BitmapData() {
|
BitmapData::~BitmapData() {
|
||||||
_keepData = false;
|
_keepData = false;
|
||||||
freeData();
|
|
||||||
if (_loaded) {
|
if (_loaded) {
|
||||||
g_driver->destroyBitmap(this);
|
g_driver->destroyBitmap(this);
|
||||||
}
|
}
|
||||||
|
freeData();
|
||||||
if (_bitmaps) {
|
if (_bitmaps) {
|
||||||
if (_bitmaps->contains(_fname)) {
|
if (_bitmaps->contains(_fname)) {
|
||||||
_bitmaps->erase(_fname);
|
_bitmaps->erase(_fname);
|
||||||
|
|
|
@ -849,6 +849,10 @@ void GfxTinyGL::drawBitmap(const Bitmap *bitmap, int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxTinyGL::destroyBitmap(BitmapData *bitmap) {
|
void GfxTinyGL::destroyBitmap(BitmapData *bitmap) {
|
||||||
|
for (int pic = 0; pic < bitmap->_numImages; pic++) {
|
||||||
|
if (bitmap->_data)
|
||||||
|
bitmap->_data[pic].free();
|
||||||
|
}
|
||||||
delete[] (BlitImage*)bitmap->_texIds;
|
delete[] (BlitImage*)bitmap->_texIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue