mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
InterruptableSensorBase: Fix callback function deletion (#1807)
Save the callback function into a unique_ptr member instead.
This commit is contained in:
committed by
Peter Johnson
parent
810e58ea85
commit
6411bd79c6
@@ -7,8 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <hal/Interrupts.h>
|
||||
|
||||
@@ -144,8 +144,8 @@ class InterruptableSensorBase : public ErrorBase, public SendableBase {
|
||||
virtual void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
|
||||
|
||||
protected:
|
||||
// atomic for proper destruction
|
||||
std::atomic<HAL_InterruptHandle> m_interrupt{HAL_kInvalidHandle};
|
||||
HAL_InterruptHandle m_interrupt{HAL_kInvalidHandle};
|
||||
std::unique_ptr<InterruptEventHandler> m_interruptHandler{nullptr};
|
||||
|
||||
void AllocateInterrupts(bool watcher);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user