diff options
author | Cameron Cawley | 2019-12-31 19:19:42 +0000 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 17:34:12 +0200 |
commit | 948c555ea616821ed7c2678ad406ed5bea392339 (patch) | |
tree | 000a4566cd70bdddff6d8f4d64edfc3db9119ac5 /graphics/fonts | |
parent | 395f707203e8f30add0b2f8e9d8616dd12468676 (diff) | |
download | scummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.tar.gz scummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.tar.bz2 scummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.zip |
ALL: Create all instances of NEResources and PEResources using new instead of on the stack
Also adapted WinCursorGroup and MacMenu to reflect this.
Diffstat (limited to 'graphics/fonts')
-rw-r--r-- | graphics/fonts/winfont.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp index ec6ce6f89a..6ba0136a52 100644 --- a/graphics/fonts/winfont.cpp +++ b/graphics/fonts/winfont.cpp @@ -86,15 +86,18 @@ bool WinFont::loadFromFON(const Common::String &fileName, const WinFontDirEntry } bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry &dirEntry) { - Common::NEResources exe; + Common::NEResources *exe = new Common::NEResources(); - if (!exe.loadFromEXE(fileName)) + if (!exe->loadFromEXE(fileName)) { + delete exe; return false; + } // Let's pull out the font directory - Common::SeekableReadStream *fontDirectory = exe.getResource(Common::kWinFontDir, Common::String("FONTDIR")); + Common::SeekableReadStream *fontDirectory = exe->getResource(Common::kWinFontDir, Common::String("FONTDIR")); if (!fontDirectory) { warning("No font directory in '%s'", fileName.c_str()); + delete exe; return false; } @@ -105,18 +108,21 @@ bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry & // Couldn't match the face name if (fontId == 0xffffffff) { warning("Could not find face '%s' in '%s'", dirEntry.faceName.c_str(), fileName.c_str()); + delete exe; return false; } // Actually go get our font now... - Common::SeekableReadStream *fontStream = exe.getResource(Common::kWinFont, fontId); + Common::SeekableReadStream *fontStream = exe->getResource(Common::kWinFont, fontId); if (!fontStream) { warning("Could not find font %d in %s", fontId, fileName.c_str()); + delete exe; return false; } bool ok = loadFromFNT(*fontStream); delete fontStream; + delete exe; return ok; } |