Permalink
Browse files

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

  • Loading branch information...
endrift committed Jul 24, 2018
1 parent c04d627 commit 5a954d63db8d1c4936232081282488172d21b288
Showing with 4 additions and 0 deletions.
  1. +2 −0 src/platform/qt/MapView.cpp
  2. +2 −0 src/platform/qt/ObjView.cpp
@@ -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
@@ -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

0 comments on commit 5a954d6

Please sign in to comment.