mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
GUI: Fix various memory leaks related to grid widget
This commit is contained in:
parent
690f9d2a5c
commit
1b3ac06f69
@ -114,7 +114,7 @@ struct ArchiveMemberListBackComparator {
|
||||
}
|
||||
};
|
||||
void GuiManager::initIconsSet() {
|
||||
Common::Archive *dat = nullptr;
|
||||
Common::Archive *dat;
|
||||
|
||||
_iconsSet.clear();
|
||||
|
||||
@ -138,26 +138,27 @@ void GuiManager::initIconsSet() {
|
||||
delete iconDir;
|
||||
}
|
||||
|
||||
dat = nullptr;
|
||||
|
||||
const char fname[] = "gui-icons.dat";
|
||||
Common::File *file = new Common::File;
|
||||
|
||||
if (ConfMan.hasKey("themepath")) {
|
||||
Common::FSNode *fs = new Common::FSNode(normalizePath(ConfMan.get("themepath") + "/" + fname, '/'));
|
||||
|
||||
if (!fs->exists()) {
|
||||
delete fs;
|
||||
} else {
|
||||
if (fs->exists()) {
|
||||
dat = Common::makeZipArchive(*fs);
|
||||
}
|
||||
delete fs;
|
||||
}
|
||||
|
||||
if (!dat && !file->isOpen() && ConfMan.hasKey("iconspath"))
|
||||
if (!dat) {
|
||||
Common::File *file = new Common::File;
|
||||
if (ConfMan.hasKey("iconspath"))
|
||||
file->open(normalizePath(ConfMan.get("iconspath") + "/" + fname, '/'));
|
||||
|
||||
if (!dat && !file->isOpen())
|
||||
if (!file->isOpen())
|
||||
file->open(fname);
|
||||
|
||||
if (!dat && file->isOpen())
|
||||
if (file->isOpen())
|
||||
dat = Common::makeZipArchive(file);
|
||||
|
||||
if (!dat) {
|
||||
@ -165,8 +166,9 @@ void GuiManager::initIconsSet() {
|
||||
delete file;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_iconsSet.add(fname, dat, 0, false); // Do not autofree
|
||||
_iconsSet.add(fname, dat);
|
||||
|
||||
debug(2, "GUI: Loaded icon file: %s", fname);
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ LauncherDialog::LauncherDialog(const Common::String &dialogName)
|
||||
}
|
||||
if (_metadataParser.parse() == false) {
|
||||
warning("Failed to parse XML file '%s'", (*md)->getDisplayName().encode().c_str());
|
||||
_metadataParser.close();
|
||||
}
|
||||
_metadataParser.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,6 +317,9 @@ Graphics::ManagedSurface *loadSurfaceFromFile(const Common::String &name, int re
|
||||
Common::SeekableReadStream *stream = g_gui.getIconsSet().createReadStreamForMember(name);
|
||||
Graphics::SVGBitmap *image = nullptr;
|
||||
image = new Graphics::SVGBitmap(stream);
|
||||
|
||||
delete stream;
|
||||
|
||||
surf = new Graphics::ManagedSurface(renderWidth, renderHeight, *image->getPixelFormat());
|
||||
image->render(*surf, renderWidth, renderHeight);
|
||||
delete image;
|
||||
|
Loading…
Reference in New Issue
Block a user