From 81b310c8abcd48836d0e014862a8804fc34d9a4a Mon Sep 17 00:00:00 2001 From: Handa Wang <7058128+superwhd@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:55:12 +0800 Subject: [ncp] clear handlers and callbacks in `NcpOpenThread::Deinit()` (#2220) This is to avoid having stale/undesired handlers when calling `NcpOpenThread::Init()`. --- src/ncp/ncp_openthread.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ncp/ncp_openthread.cpp b/src/ncp/ncp_openthread.cpp index efd3e7f0..84a86014 100644 --- a/src/ncp/ncp_openthread.cpp +++ b/src/ncp/ncp_openthread.cpp @@ -296,6 +296,9 @@ void ControllerOpenThread::Deinit(void) otSysDeinit(); mInstance = nullptr; + + mThreadStateChangedCallbacks.clear(); + mResetHandlers.clear(); } void ControllerOpenThread::HandleStateChanged(otChangedFlags aFlags) -- cgit v1.2.3