-
-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
this simple sample code taken from the docs leads to segfault:
#include <reactphysics3d/reactphysics3d.h>
using namespace reactphysics3d;
int main(void) {
PhysicsCommon physicsCommon;
// Create a physics world
PhysicsWorld *world = physicsCommon.createPhysicsWorld();
// Create the default logger
DefaultLogger *logger = physicsCommon.createDefaultLogger();
// Log level (warnings and errors)
uint logLevel = static_cast<uint>(static_cast<uint>(Logger::Level::Warning) |
static_cast<uint>(Logger::Level::Error));
// Output the logs into an HTML file
logger->addFileDestination("rp3d_log.html", logLevel,
DefaultLogger::Format::HTML);
// Output the logs into the standard output
logger->addStreamDestination(std::cout, logLevel,
DefaultLogger::Format::Text);
// Set the logger
physicsCommon.setLogger(logger);
physicsCommon.destroyDefaultLogger(logger);
return 0;
}segfaults on log here because the static PhysicsCommon logger is not set to null after destruction.
Calling physicsCommon.setLogger(nullptr); after destroying the default logger prevents that.
Maybe there should be a check in destroyDefaultLogger or deleteDefaultLogger on the logger being deleted. If it is the current PhysicsCommon logger, set to nullptr ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels