Merge pull request #33373 from ktksgit/fix_crash_in_pluginscript

Fix crash in PluginScript destructor
This commit is contained in:
Rémi Verschelde 2019-11-06 15:32:35 +01:00 committed by GitHub
commit 5cdd17194e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() {
if (_desc && _data) {
_desc->finish(_data); _desc->finish(_data);
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (_language) {
_language->lock(); _language->lock();
_language->_script_list.remove(&_script_list); _language->_script_list.remove(&_script_list);
_language->unlock(); _language->unlock();
}
#endif #endif
} }