diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-04-06 18:43:10 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-04-06 18:43:17 +0100 |
| commit | fa79aacea30eff5c4e3e094ceb98c316d53caefa (patch) | |
| tree | 1e759fbf57bf52e9d369967cc3f1e4e5ddc358ac | |
| parent | 265c7924d85e2ad5f2ff0e9f59c03403028eaef4 (diff) | |
constraint: fix possible uaf on double destruction
ref #5448
| -rw-r--r-- | src/desktop/Constraint.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/desktop/Constraint.cpp b/src/desktop/Constraint.cpp index e7858321..dfe8d217 100644 --- a/src/desktop/Constraint.cpp +++ b/src/desktop/Constraint.cpp @@ -3,6 +3,9 @@ #include "../Compositor.hpp" CConstraint::CConstraint(wlr_pointer_constraint_v1* constraint, CWLSurface* owner) : m_pOwner(owner), m_pConstraint(constraint) { + RASSERT(!constraint->data, "CConstraint: attempted to duplicate ownership"); + + constraint->data = this; initSignals(); m_vCursorPosOnActivate = g_pInputManager->getMouseCoordsInternal(); @@ -97,13 +100,13 @@ void CConstraint::deactivate() { m_bActive = false; - wlr_pointer_constraint_v1_send_deactivated(m_pConstraint); - if (isLocked()) g_pCompositor->warpCursorTo(logicPositionHint(), true); if (m_pConstraint->lifetime == ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT) m_bDead = true; + + wlr_pointer_constraint_v1_send_deactivated(m_pConstraint); } void CConstraint::activate() { |
