mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
rwengine: Store btOverlappingPairCallback in GameWorld
Should fix this memory leak: ==16721== 8 bytes in 1 blocks are definitely lost in loss record 7 of 264 ==16721== at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334) ==16721== by 0x7E7B5D: GameWorld::GameWorld(Logger*, GameData*) (GameWorld.cpp:100) ==16721== by 0x76EC0B: std::_MakeUniq<GameWorld>::__single_object std::make_unique<GameWorld, Logger*, GameData*>(Logger*&&, GameData*&&) (unique_ptr.h:825) ==16721== by 0x760F50: RWGame::newGame() (RWGame.cpp:107) ==16721== by 0x78E713: LoadingState::enter() (LoadingState.cpp:9) ==16721== by 0x76602B: void StateManager::enter<LoadingState, RWGame*, RWGame::RWGame(Logger&, int, ch ar**)::{lambda()#1}>(RWGame*&&, RWGame::RWGame(Logger&, int, char**)::{lambda()#1}&&) (StateManager.hpp:4 0) ==16721== by 0x760842: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:81) ==16721== by 0x750385: main (main.cpp:13)
This commit is contained in:
parent
a610ea2387
commit
8012a5065d
@ -98,8 +98,9 @@ GameWorld::GameWorld(Logger* log, GameData* dat)
|
||||
collisionConfig.get());
|
||||
|
||||
dynamicsWorld->setGravity(btVector3(0.f, 0.f, -9.81f));
|
||||
_overlappingPairCallback = std::make_unique<btGhostPairCallback>();
|
||||
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(
|
||||
new btGhostPairCallback());
|
||||
_overlappingPairCallback.get());
|
||||
gContactProcessedCallback = ContactProcessedCallback;
|
||||
dynamicsWorld->setInternalTickCallback(PhysicsTickCallback, this);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ struct WeaponScan;
|
||||
struct VehicleGenerator;
|
||||
|
||||
#include <data/Chase.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <btBulletCollisionCommon.h>
|
||||
@ -343,6 +342,11 @@ private:
|
||||
* Flag for pausing the simulation
|
||||
*/
|
||||
bool paused;
|
||||
|
||||
/**
|
||||
* Private data
|
||||
*/
|
||||
std::unique_ptr<btOverlappingPairCallback> _overlappingPairCallback;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user