mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-26 14:56:39 +00:00 
			
		
		
		
	Merge branch 'fix_crash' into 'master'
Fix crash in LuaUtil::ScriptsContainer::~ScriptsContainer() See merge request OpenMW/openmw!1252
This commit is contained in:
		
						commit
						5f3a36a9b7
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		|  | @ -328,6 +328,12 @@ namespace LuaUtil | ||||||
|         std::make_heap(mHoursTimersQueue.begin(), mHoursTimersQueue.end()); |         std::make_heap(mHoursTimersQueue.begin(), mHoursTimersQueue.end()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     ScriptsContainer::~ScriptsContainer() | ||||||
|  |     { | ||||||
|  |         for (auto& [_, script] : mScripts) | ||||||
|  |             script.mHiddenData[ScriptId::KEY] = sol::nil; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     void ScriptsContainer::removeAllScripts() |     void ScriptsContainer::removeAllScripts() | ||||||
|     { |     { | ||||||
|         for (auto& [_, script] : mScripts) |         for (auto& [_, script] : mScripts) | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ namespace LuaUtil | ||||||
|         ScriptsContainer(LuaUtil::LuaState* lua, std::string_view namePrefix); |         ScriptsContainer(LuaUtil::LuaState* lua, std::string_view namePrefix); | ||||||
|         ScriptsContainer(const ScriptsContainer&) = delete; |         ScriptsContainer(const ScriptsContainer&) = delete; | ||||||
|         ScriptsContainer(ScriptsContainer&&) = delete; |         ScriptsContainer(ScriptsContainer&&) = delete; | ||||||
|         virtual ~ScriptsContainer() { removeAllScripts(); } |         virtual ~ScriptsContainer(); | ||||||
| 
 | 
 | ||||||
|         // Adds package that will be available (via `require`) for all scripts in the container.
 |         // Adds package that will be available (via `require`) for all scripts in the container.
 | ||||||
|         // Automatically applies LuaUtil::makeReadOnly to the package.
 |         // Automatically applies LuaUtil::makeReadOnly to the package.
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue