Fix crash in PluginScript destructor

This commit is contained in:
ktksgit 2019-11-05 23:09:56 +01:00
parent 34d4c2ed81
commit eedf4b27a1
1 changed files with 10 additions and 4 deletions

View File

@ -473,6 +473,8 @@ MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
PluginScript::PluginScript() : PluginScript::PluginScript() :
_data(NULL), _data(NULL),
_desc(NULL),
_language(NULL),
_tool(false), _tool(false),
_valid(false), _valid(false),
_script_list(this) { _script_list(this) {
@ -490,11 +492,15 @@ void PluginScript::init(PluginScriptLanguage *language) {
} }
PluginScript::~PluginScript() { PluginScript::~PluginScript() {
_desc->finish(_data); if (_desc && _data) {
_desc->finish(_data);
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
_language->lock(); if (_language) {
_language->_script_list.remove(&_script_list); _language->lock();
_language->unlock(); _language->_script_list.remove(&_script_list);
_language->unlock();
}
#endif #endif
} }