scummvm/base
Colin Snover d087c9605f BASE: Remove bad casts between incompatible Plugin types
Previously, a C-style cast was used to convert a
Common::Array<Plugin *>, populated with pointers to StaticPlugin
and DynamicPlugin instances, to a
Common::Array<PluginSubclass<T> *>, but PluginSubclass<T> is a
*sibling* class to StaticPlugin/DynamicPlugin, so this cast was
invalid and the results undefined. The methods for retrieving
subclasses of plugins can't be easily changed to just generate an
array of temporary wrapper objects that expose an identical API
which dereferences to the preferred PluginObject subclass because
pointers to these objects are retained by other parts of ScummVM,
so the wrappers would needed to be persisted or they would need to
just re-expose the underlying Plugin object again. This indicated
that a way to solve this problem is to have the callers receive
Plugin objects and get the PluginObject from the Plugin by
explicitly stating their desired type, in a similar manner to
std::get(std::variant), so that the pattern used by this patch to
solve the problem.

Closes gh-1051.
2017-12-03 20:26:38 -06:00
..
commandLine.cpp BASE: Remove bad casts between incompatible Plugin types 2017-12-03 20:26:38 -06:00
commandLine.h BASE: Make GPL headers consistent in themselves. 2014-02-18 02:39:32 +01:00
internal_revision.h.in CREATE_PROJECT: Update revision number support (fixes bug #3280881) 2011-04-24 16:59:46 -04:00
internal_version.h RELEASE: This is 2.1.0git 2017-11-30 00:13:10 +00:00
internal_version.h.in CREATE_PROJECT: Update revision number support (fixes bug #3280881) 2011-04-24 16:59:46 -04:00
main.cpp BASE: Remove bad casts between incompatible Plugin types 2017-12-03 20:26:38 -06:00
main.h BASE: Make GPL headers consistent in themselves. 2014-02-18 02:39:32 +01:00
module.mk
plugins.cpp BASE: Remove bad casts between incompatible Plugin types 2017-12-03 20:26:38 -06:00
plugins.h BASE: Remove bad casts between incompatible Plugin types 2017-12-03 20:26:38 -06:00
version.cpp AMIGAOS: Amiga needs date in specific format in version cookie. Now AmiUpdate works 2016-09-10 22:19:32 +02:00
version.h BASE: Make GPL headers consistent in themselves. 2014-02-18 02:39:32 +01:00