mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-05 02:17:05 +00:00
adopted clone2727 patch: ALL: Fix segfault upon launch
This commit is contained in:
parent
759ce8f786
commit
f1420f4704
@ -59,13 +59,6 @@
|
||||
|
||||
namespace Grim {
|
||||
|
||||
static const bool color = ObjectManager::registerType<Color>();
|
||||
static const bool luafile = ObjectManager::registerType<LuaFile>();
|
||||
// static const bool bitmap = ObjectManager::registerType<Bitmap>();
|
||||
// static const bool costume = ObjectManager::registerType<Costume>();
|
||||
static const bool font = ObjectManager::registerType<Font>();
|
||||
// static const bool material = ObjectManager::registerType<Material>();
|
||||
|
||||
static bool g_lua_initialized = false;
|
||||
|
||||
// Entries in the system.controls table
|
||||
@ -252,6 +245,13 @@ GrimEngine::GrimEngine(OSystem *syst, int gameFlags) :
|
||||
Engine(syst), _currScene(NULL), _selectedActor(NULL) {
|
||||
g_grim = this;
|
||||
|
||||
ObjectManager::registerType<Color>();
|
||||
ObjectManager::registerType<LuaFile>();
|
||||
//ObjectManager::registerType<Bitmap>();
|
||||
//ObjectManager::registerType<Costume>();
|
||||
ObjectManager::registerType<Font>();
|
||||
//ObjectManager::registerType<Material>();
|
||||
|
||||
_gameFlags = gameFlags;
|
||||
|
||||
g_registry = new Registry();
|
||||
@ -317,6 +317,8 @@ GrimEngine::GrimEngine(OSystem *syst, int gameFlags) :
|
||||
}
|
||||
|
||||
GrimEngine::~GrimEngine() {
|
||||
ObjectManager::clearTypes();
|
||||
|
||||
delete[] _controlsEnabled;
|
||||
delete[] _controlsState;
|
||||
|
||||
|
@ -174,7 +174,8 @@ public:
|
||||
static void saveObject(SaveGame *state, Object *object);
|
||||
static ObjectPtr<Object> restoreObject(SaveGame *state);
|
||||
|
||||
template<class T> static bool registerType() {
|
||||
template<class T>
|
||||
static bool registerType() {
|
||||
T obj;
|
||||
Common::String type = obj.typeName();
|
||||
if (_creators.contains(type)) {
|
||||
@ -186,8 +187,13 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static void clearTypes() {
|
||||
_creators.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
template<class T> static Object *createObj() {
|
||||
template<class T>
|
||||
static Object *createObj() {
|
||||
return new T();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user