From 94543467822401b407f4b061268e42d59d6a905b Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Wed, 1 Jan 2020 08:19:48 +0100 Subject: ENGINES: Copy the data referenced by QualifiedGameDescriptor The engineId, gameId and description come from static data in the game engines. When the game engines are compiled as dynamic plugins, the QGD structure may outlive the engine plugin. Making a copy ensures the data remains available. Fixes #11292. --- base/commandLine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index c8ceea77af..bb7f93a274 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -804,7 +804,7 @@ static void listTargets() { // If there's no description, fallback on the default description. if (description.empty()) { QualifiedGameDescriptor g = EngineMan.findTarget(name); - if (g.description) + if (!g.description.empty()) description = g.description; } // If there's still no description, we cannot come up with one. Insert some dummy text. @@ -854,7 +854,7 @@ static Common::Error listSaves(const Common::String &singleTarget) { currentTarget = *i; EngineMan.upgradeTargetIfNecessary(*i); game = EngineMan.findTarget(*i, &plugin); - } else if (game = findGameMatchingName(*i), game.gameId) { + } else if (game = findGameMatchingName(*i), !game.gameId.empty()) { // The name is a known game id plugin = EngineMan.findPlugin(game.engineId); currentTarget = createTemporaryTarget(game.engineId, game.gameId); @@ -1278,7 +1278,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo QualifiedGameDescriptor gameOption; if (settings.contains("game")) { gameOption = findGameMatchingName(settings["game"]); - if (!gameOption.gameId) { + if (gameOption.gameId.empty()) { usage("Unrecognized game '%s'. Use the --list-games command for a list of accepted values.\n", settings["game"].c_str()); } } @@ -1361,7 +1361,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo if (ConfMan.hasGameDomain(command)) { // Command is a known target ConfMan.setActiveDomain(command); - } else if (gd = findGameMatchingName(command), gd.gameId) { + } else if (gd = findGameMatchingName(command), !gd.gameId.empty()) { // Command is a known game ID Common::String domainName = createTemporaryTarget(gd.engineId, gd.gameId); ConfMan.setActiveDomain(domainName); -- cgit v1.2.3