From 5803a8c0d66b5de7c2021faa784793327519ab4e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 21 Dec 2018 13:42:37 -0800 Subject: [PATCH] Fix: crash while destructing crmorch (#731) --- orchagent/crmorch.cpp | 3 ++- orchagent/crmorch.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/orchagent/crmorch.cpp b/orchagent/crmorch.cpp index 56f7e5bb38..a590445c5b 100644 --- a/orchagent/crmorch.cpp +++ b/orchagent/crmorch.cpp @@ -165,7 +165,8 @@ CrmOrch::CrmOrch(DBConnector *db, string tableName): // The CRM stats needs to be populated again m_countersCrmTable->del(CRM_COUNTERS_TABLE_KEY); - auto executor = new ExecutableTimer(m_timer.get(), this, "CRM_COUNTERS_POLL"); + // Note: ExecutableTimer will hold m_timer pointer and release the object later + auto executor = new ExecutableTimer(m_timer, this, "CRM_COUNTERS_POLL"); Orch::addExecutor(executor); m_timer->start(); } diff --git a/orchagent/crmorch.h b/orchagent/crmorch.h index fd850349d5..eac50da992 100644 --- a/orchagent/crmorch.h +++ b/orchagent/crmorch.h @@ -52,7 +52,7 @@ class CrmOrch : public Orch private: shared_ptr m_countersDb = nullptr; shared_ptr m_countersCrmTable = nullptr; - shared_ptr m_timer = nullptr; + SelectableTimer *m_timer = nullptr; struct CrmResourceCounter {