mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-09 03:57:51 +03:00
Remove PhysicsManager singleton and use shared_ptr instead. Resolves the issue where sometimes destructors were called in an unexpected sequence resulting in a crash while exiting the application.
This commit is contained in:
parent
4c1906b999
commit
2720e5ea9d
19 changed files with 47 additions and 200 deletions
|
@ -9,6 +9,8 @@
|
|||
#include <components/files/configurationmanager.hpp>
|
||||
#endif
|
||||
|
||||
#include "../../view/world/physicssystem.hpp"
|
||||
|
||||
void CSMDoc::Document::addGmsts()
|
||||
{
|
||||
static const char *gmstFloats[] =
|
||||
|
@ -2253,7 +2255,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
mSaving (*this, mProjectPath, encoding),
|
||||
mRunner (mProjectPath)
|
||||
mRunner (mProjectPath), mPhysics(boost::shared_ptr<CSVWorld::PhysicsSystem>())
|
||||
{
|
||||
if (mContentFiles.empty())
|
||||
throw std::runtime_error ("Empty content file sequence");
|
||||
|
@ -2464,3 +2466,11 @@ void CSMDoc::Document::progress (int current, int max, int type)
|
|||
{
|
||||
emit progress (current, max, type, 1, this);
|
||||
}
|
||||
|
||||
boost::shared_ptr<CSVWorld::PhysicsSystem> CSMDoc::Document::getPhysics ()
|
||||
{
|
||||
if(!mPhysics)
|
||||
mPhysics = boost::shared_ptr<CSVWorld::PhysicsSystem> (new CSVWorld::PhysicsSystem());
|
||||
|
||||
return mPhysics;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue