From 52459a19e35da20c4eae4feed98bfe30a7b3398a Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com>
Date: Mon, 7 May 2012 15:58:48 -0400
Subject: [PATCH] Save history everytime it change, prevent the file never to
 be saved in some senario (SIG, crash, ASSERT, etc)

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

diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index adbd55b847..3d4b115d64 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -346,6 +346,7 @@ void ManagerImpl::hangupCall(const std::string& callId)
             Call * call = SIPVoIPLink::instance()->getCall(callId);
             history_.addCall(call, preferences.getHistoryLimit());
             SIPVoIPLink::instance()->hangup(callId);
+            saveHistory();
         } catch (const VoipLinkException &e) {
             ERROR("%s", e.what());
         }
@@ -356,6 +357,7 @@ void ManagerImpl::hangupCall(const std::string& callId)
         history_.addCall(call, preferences.getHistoryLimit());
         link->hangup(callId);
         removeCallAccount(callId);
+        saveHistory();
     }
 
     getMainBuffer()->stateInfo();
@@ -1535,6 +1537,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id)
         Call * call = SIPVoIPLink::instance()->getCall(call_id);
         history_.addCall(call, preferences.getHistoryLimit());
         SIPVoIPLink::instance()->hangup(call_id);
+        saveHistory();
     }
     else {
         const std::string account_id(getAccountFromCall(call_id));
@@ -1542,6 +1545,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id)
         Call * call = link->getCall(call_id);
         history_.addCall(call, preferences.getHistoryLimit());
         link->peerHungup(call_id);
+        saveHistory();
     }
 
     /* Broadcast a signal over DBus */
-- 
GitLab