From 43f8f21df6a9d3cfb37ff214193d31a03d98a362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Wed, 8 Mar 2017 13:16:53 +0100 Subject: [PATCH 1/2] Physics2D/RigidBody2D: Fix SetMass occasionnal crash --- src/Nazara/Physics2D/RigidBody2D.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Nazara/Physics2D/RigidBody2D.cpp b/src/Nazara/Physics2D/RigidBody2D.cpp index aef36d0ad..8bf713402 100644 --- a/src/Nazara/Physics2D/RigidBody2D.cpp +++ b/src/Nazara/Physics2D/RigidBody2D.cpp @@ -245,23 +245,26 @@ namespace Nz { if (mass > 0.f) { - cpBodySetMass(m_handle, mass); - cpBodySetMoment(m_handle, m_geom->ComputeInertialMatrix(m_mass)); + m_world->RegisterPostStep(this, [this, mass]() + { + cpBodySetMass(m_handle, mass); + cpBodySetMoment(m_handle, m_geom->ComputeInertialMatrix(m_mass)); + }); } else m_world->RegisterPostStep(this, [this]() { cpBodySetType(m_handle, CP_BODY_TYPE_STATIC); } ); } else if (mass > 0.f) { - if (cpBodyGetType(m_handle) == CP_BODY_TYPE_STATIC) + m_world->RegisterPostStep(this, [this, mass]() { - m_world->RegisterPostStep(this, [this, mass]() + if (cpBodyGetType(m_handle) == CP_BODY_TYPE_STATIC) { cpBodySetType(m_handle, CP_BODY_TYPE_DYNAMIC); cpBodySetMass(m_handle, mass); cpBodySetMoment(m_handle, m_geom->ComputeInertialMatrix(m_mass)); - }); - } + } + }); } m_mass = mass; From b0d61802b626858e530db0097ea57b1fd85942a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Wed, 8 Mar 2017 13:17:04 +0100 Subject: [PATCH 2/2] Network/SocketPoller: Fix documentation --- src/Nazara/Network/SocketPoller.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Nazara/Network/SocketPoller.cpp b/src/Nazara/Network/SocketPoller.cpp index fa5aa837e..43250a84f 100644 --- a/src/Nazara/Network/SocketPoller.cpp +++ b/src/Nazara/Network/SocketPoller.cpp @@ -142,13 +142,15 @@ namespace Nz } /*! - * \brief Wait until any registered socket switches to a ready state + * \brief Wait until any registered socket switches to a ready state. * * Waits a specific/undetermined amount of time until at least one socket part of the SocketPoller becomes ready. * To query the ready state of the registered socket, use the IsReady function. * * \param msTimeout Maximum time to wait in milliseconds, 0 for infinity * + * \return True if at least one socket registered to the poller is ready. + * * \remark It is an error to try to unregister a non-registered socket from a SocketPoller. * * \see IsReady