Qt: Fix sprite/map export file handle leaks (fixs #1141)

This commit is contained in:
Vicki Pfau 2018-07-23 18:51:33 -07:00
parent c04d627de8
commit 5a954d63db
2 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "LogController.h"
#include <mgba-util/png-io.h>
#include <mgba-util/vfs.h>
#ifdef M_CORE_GBA
#include <mgba/internal/gba/memory.h>
#endif
@ -184,5 +185,6 @@ void MapView::exportMap() {
QImage map = m_rawMap.rgbSwapped();
PNGWritePixelsA(png, map.width(), map.height(), map.bytesPerLine() / 4, static_cast<const void*>(map.constBits()));
PNGWriteClose(png, info);
vf->close(vf);
}
#endif

View File

@ -22,6 +22,7 @@
#include <mgba/internal/gb/io.h>
#endif
#include <mgba-util/png-io.h>
#include <mgba-util/vfs.h>
using namespace QGBA;
@ -283,6 +284,7 @@ void ObjView::exportObj() {
PNGWritePixels8(png, m_objInfo.width * 8, m_objInfo.height * 8, m_objInfo.width * 8, static_cast<void*>(buffer));
PNGWriteClose(png, info);
delete[] buffer;
vf->close(vf);
}
#endif