diff options
author | Bastien Bouclet | 2020-01-01 08:19:48 +0100 |
---|---|---|
committer | Bastien Bouclet | 2020-01-01 08:19:48 +0100 |
commit | 94543467822401b407f4b061268e42d59d6a905b (patch) | |
tree | 09220358172e1e665c66d97e57c368381bab9261 /engines | |
parent | 13e0ea0ad47e2863b6e1fa319042507b762621a3 (diff) | |
download | scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.tar.gz scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.tar.bz2 scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.zip |
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.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/game.cpp | 14 | ||||
-rw-r--r-- | engines/game.h | 8 |
2 files changed, 8 insertions, 14 deletions
diff --git a/engines/game.cpp b/engines/game.cpp index b706e1d976..b90381d2d3 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -49,18 +49,10 @@ PlainGameDescriptor PlainGameDescriptor::of(const char *gameId, const char *desc return pgd; } -QualifiedGameDescriptor::QualifiedGameDescriptor() : - PlainGameDescriptor() { - engineId = nullptr; - gameId = nullptr; - description = nullptr; -} - QualifiedGameDescriptor::QualifiedGameDescriptor(const char *engine, const PlainGameDescriptor &pgd) : - PlainGameDescriptor() { - engineId = engine; - gameId = pgd.gameId; - description = pgd.description; + engineId(engine), + gameId(pgd.gameId), + description(pgd.description) { } DetectedGame::DetectedGame() : diff --git a/engines/game.h b/engines/game.h index e378976cb1..8316857e24 100644 --- a/engines/game.h +++ b/engines/game.h @@ -66,10 +66,12 @@ public: /** * The description of a game supported by an engine */ -struct QualifiedGameDescriptor : public PlainGameDescriptor { - const char *engineId; +struct QualifiedGameDescriptor { + Common::String engineId; + Common::String gameId; + Common::String description; - QualifiedGameDescriptor(); + QualifiedGameDescriptor() {} QualifiedGameDescriptor(const char *engine, const PlainGameDescriptor &pgd); }; |