aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanda Wang <7058128+superwhd@users.noreply.github.com>2024-03-12 23:55:12 +0800
committerGitHub <noreply@github.com>2024-03-12 08:55:12 -0700
commit81b310c8abcd48836d0e014862a8804fc34d9a4a (patch)
tree09875fd97230319aa0d342d08ed4d538c5b890e5
parent3117caa881bbf36ddd111c56c35c8cde3af51791 (diff)
downloadot-br-posix-81b310c8abcd48836d0e014862a8804fc34d9a4a.tar.gz
[ncp] clear handlers and callbacks in `NcpOpenThread::Deinit()` (#2220)
This is to avoid having stale/undesired handlers when calling `NcpOpenThread::Init()`.
-rw-r--r--src/ncp/ncp_openthread.cpp3
1 files changed, 3 insertions, 0 deletions
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)