PIM: fix potential segfault during shutdown

When syncevo-dbus-server was shutting down due to a signal and there
was a sync session running that was triggered via the PIM Manager API,
then a segfault occurred because the manager instance got destroyed
before invoking a Session callback holding a pointer to it.

The fix is to use slot tracking of the weak pointer.
This commit is contained in:
Patrick Ohly 2014-08-26 16:48:00 +02:00
parent b02b83bce0
commit 81ea67f74a
1 changed files with 1 additions and 1 deletions

View File

@ -1542,7 +1542,7 @@ void Manager::doSyncPeer(const boost::shared_ptr<Session> &session,
{
// Keep client informed about progress.
emitSyncProgress(uid, "started", SyncResult());
session->m_doneSignal.connect(boost::bind(boost::ref(emitSyncProgress), uid, "done", SyncResult()));
session->m_doneSignal.connect(Session::DoneSignal_t::slot_type(boost::ref(emitSyncProgress), uid, "done", SyncResult()).track(m_self)); // emitSyncProgress indirectly relies in the "this" pointer
session->m_sourceSynced.connect(boost::bind(&Manager::report2SyncProgress, m_self, uid, _1, _2));
// React *before* Session updates its value for getLastProgress(). */
session->m_progressSignal.connect(boost::bind(&Manager::progress2SyncProgress, m_self, uid, session.get(), _1, _2),