From 8ef044808e8fc0bb373b82c721d593697d1055bc Mon Sep 17 00:00:00 2001
From: Tristan Matthews <le.businessman@gmail.com>
Date: Sun, 25 Mar 2012 12:05:41 -0400
Subject: [PATCH] * #9508: fixes segfault in manager by changing order in which
 destructors are called

---
 daemon/src/managerimpl.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index a9b190d1ad..3cb0d6cac8 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -131,10 +131,12 @@ void ManagerImpl::terminate()
 
     saveConfig();
 
-    unloadAccountMap();
-
     delete SIPVoIPLink::instance();
 
+    // Unload account map AFTER destroying
+    // the SIPVoIPLink, the link still needs the accounts for pjsip cleanup
+    unloadAccountMap();
+
     ost::MutexLock lock(audioLayerMutex_);
 
     delete audiodriver_;
-- 
GitLab