Commit 1df2fa4c authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7130: Fix segfault when detaching participant

Conference object was being deleted in processRemainingParticipants and then called.
parent a9f3dc57
...@@ -187,7 +187,7 @@ class Account : public Serializable { ...@@ -187,7 +187,7 @@ class Account : public Serializable {
* Get the voiplink pointer * Get the voiplink pointer
* @return VoIPLink* the pointer or 0 * @return VoIPLink* the pointer or 0
*/ */
VoIPLink* getVoIPLink() const { VoIPLink* getVoIPLink() {
return link_; return link_;
} }
......
...@@ -37,45 +37,45 @@ ...@@ -37,45 +37,45 @@
#include "audio/mainbuffer.h" #include "audio/mainbuffer.h"
Conference::Conference() Conference::Conference()
: _id(Manager::instance().getNewCallID()) : id_(Manager::instance().getNewCallID())
, _confState(ACTIVE_ATTACHED) , confState_(ACTIVE_ATTACHED)
{ {
Recordable::initRecFileName(_id); Recordable::initRecFileName(id_);
} }
int Conference::getState() const int Conference::getState() const
{ {
return _confState; return confState_;
} }
void Conference::setState(ConferenceState state) void Conference::setState(ConferenceState state)
{ {
_confState = state; confState_ = state;
} }
void Conference::add(const std::string &participant_id) void Conference::add(const std::string &participant_id)
{ {
_participants.insert(participant_id); participants_.insert(participant_id);
} }
void Conference::remove(const std::string &participant_id) void Conference::remove(const std::string &participant_id)
{ {
_participants.erase(participant_id); participants_.erase(participant_id);
} }
void Conference::bindParticipant(const std::string &participant_id) void Conference::bindParticipant(const std::string &participant_id)
{ {
for (ParticipantSet::iterator iter = _participants.begin(); for (ParticipantSet::iterator iter = participants_.begin();
iter != _participants.end(); ++iter) iter != participants_.end(); ++iter)
if (participant_id != *iter) if (participant_id != *iter)
Manager::instance().getMainBuffer()->bindCallID(participant_id, *iter); Manager::instance().getMainBuffer()->bindCallID(participant_id, *iter);
Manager::instance().getMainBuffer()->bindCallID(participant_id); Manager::instance().getMainBuffer()->bindCallID(participant_id);
} }
std::string Conference::getStateStr() std::string Conference::getStateStr() const
{ {
switch (_confState) { switch (confState_) {
case ACTIVE_ATTACHED: case ACTIVE_ATTACHED:
return "ACTIVE_ATTACHED"; return "ACTIVE_ATTACHED";
case ACTIVE_DETACHED: case ACTIVE_DETACHED:
...@@ -95,7 +95,7 @@ std::string Conference::getStateStr() ...@@ -95,7 +95,7 @@ std::string Conference::getStateStr()
ParticipantSet Conference::getParticipantList() const ParticipantSet Conference::getParticipantList() const
{ {
return _participants; return participants_;
} }
bool Conference::setRecording() bool Conference::setRecording()
...@@ -105,19 +105,18 @@ bool Conference::setRecording() ...@@ -105,19 +105,18 @@ bool Conference::setRecording()
Recordable::recAudio.setRecording(); Recordable::recAudio.setRecording();
MainBuffer *mbuffer = Manager::instance().getMainBuffer(); MainBuffer *mbuffer = Manager::instance().getMainBuffer();
ParticipantSet::iterator iter; std::string process_id(Recordable::recorder.getRecorderID());
std::string process_id = Recordable::recorder.getRecorderID();
// start recording // start recording
if (!recordStatus) { if (!recordStatus) {
for (iter = _participants.begin(); iter != _participants.end(); ++iter) for (ParticipantSet::const_iterator iter = participants_.begin(); iter != participants_.end(); ++iter)
mbuffer->bindHalfDuplexOut(process_id, *iter); mbuffer->bindHalfDuplexOut(process_id, *iter);
mbuffer->bindHalfDuplexOut(process_id); mbuffer->bindHalfDuplexOut(process_id);
Recordable::recorder.start(); Recordable::recorder.start();
} else { } else {
for (iter = _participants.begin(); iter != _participants.end(); ++iter) for (ParticipantSet::const_iterator iter = participants_.begin(); iter != participants_.end(); ++iter)
mbuffer->unBindHalfDuplexOut(process_id, *iter); mbuffer->unBindHalfDuplexOut(process_id, *iter);
mbuffer->unBindHalfDuplexOut(process_id); mbuffer->unBindHalfDuplexOut(process_id);
...@@ -125,3 +124,12 @@ bool Conference::setRecording() ...@@ -125,3 +124,12 @@ bool Conference::setRecording()
return recordStatus; return recordStatus;
} }
std::string Conference::getRecFileId() const {
return getConfID();
}
std::string Conference::getConfID() const {
return id_;
}
...@@ -49,9 +49,7 @@ class Conference: public Recordable { ...@@ -49,9 +49,7 @@ class Conference: public Recordable {
/** /**
* Return the conference id * Return the conference id
*/ */
std::string getConfID() const { std::string getConfID() const;
return _id;
}
/** /**
* Return the current conference state * Return the current conference state
...@@ -66,7 +64,7 @@ class Conference: public Recordable { ...@@ -66,7 +64,7 @@ class Conference: public Recordable {
/** /**
* Return a string description of the conference state * Return a string description of the conference state
*/ */
std::string getStateStr(); std::string getStateStr() const;
/** /**
* Add a new participant to the conference * Add a new participant to the conference
...@@ -91,31 +89,18 @@ class Conference: public Recordable { ...@@ -91,31 +89,18 @@ class Conference: public Recordable {
/** /**
* Get recording file ID * Get recording file ID
*/ */
std::string getRecFileId() const { std::string getRecFileId() const;
return getConfID();
}
/** /**
* Start/stop recording toggle * Start/stop recording toggle
*/ */
virtual bool setRecording(); virtual bool setRecording();
private: private:
std::string id_;
/** ConferenceState confState_;
* Unique ID of the conference
*/
std::string _id;
/**
* Conference state
*/
ConferenceState _confState;
/** ParticipantSet participants_;
* List of participant ids
*/
ParticipantSet _participants;
}; };
#endif #endif
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*/ */
#include <cstdlib> #include <cstdlib>
#include <dbusmanager.h> #include "dbusmanager.h"
#include "global.h" #include "global.h"
#include "manager.h" #include "manager.h"
#include "instance.h" #include "instance.h"
...@@ -42,43 +42,43 @@ DBusManager::DBusManager() ...@@ -42,43 +42,43 @@ DBusManager::DBusManager()
{ {
try { try {
DBus::_init_threading(); DBus::_init_threading();
DBus::default_dispatcher = &_dispatcher; DBus::default_dispatcher = &dispatcher_;
DBus::Connection sessionConnection = DBus::Connection::SessionBus(); DBus::Connection sessionConnection = DBus::Connection::SessionBus();
sessionConnection.request_name("org.sflphone.SFLphone"); sessionConnection.request_name("org.sflphone.SFLphone");
_callManager = new CallManager(sessionConnection); callManager_ = new CallManager(sessionConnection);
_configurationManager = new ConfigurationManager(sessionConnection); configurationManager_ = new ConfigurationManager(sessionConnection);
_instanceManager = new Instance(sessionConnection); instanceManager_ = new Instance(sessionConnection);
#ifdef USE_NETWORKMANAGER #ifdef USE_NETWORKMANAGER
DBus::Connection systemConnection = DBus::Connection::SystemBus(); DBus::Connection systemConnection = DBus::Connection::SystemBus();
_networkManager = new NetworkManager(systemConnection, "/org/freedesktop/NetworkManager", ""); networkManager_ = new NetworkManager(systemConnection, "/org/freedesktop/NetworkManager", "");
#endif #endif
} catch (const DBus::Error &err) { } catch (const DBus::Error &err) {
_error("%s: %s, exiting\n", err.name(), err.what()); _error("%s: %s, exiting\n", err.name(), err.what());
::exit(1); ::exit(EXIT_FAILURE);
} }
} }
DBusManager::~DBusManager() DBusManager::~DBusManager()
{ {
#ifdef USE_NETWORKMANAGER #ifdef USE_NETWORKMANAGER
delete _networkManager; delete networkManager_;
#endif #endif
delete _instanceManager; delete instanceManager_;
delete _configurationManager; delete configurationManager_;
delete _callManager; delete callManager_;
} }
void DBusManager::exec() void DBusManager::exec()
{ {
_dispatcher.enter(); dispatcher_.enter();
} }
void void
DBusManager::exit() DBusManager::exit()
{ {
_dispatcher.leave(); dispatcher_.leave();
} }
...@@ -43,23 +43,23 @@ class DBusManager { ...@@ -43,23 +43,23 @@ class DBusManager {
DBusManager(); DBusManager();
~DBusManager(); ~DBusManager();
CallManager * getCallManager() const { CallManager * getCallManager() {
return _callManager; return callManager_;
}; };
ConfigurationManager * getConfigurationManager() const { ConfigurationManager * getConfigurationManager() {
return _configurationManager; return configurationManager_;
}; };
void exec(); void exec();
void exit(); void exit();
private: private:
CallManager* _callManager; CallManager* callManager_;
ConfigurationManager* _configurationManager; ConfigurationManager* configurationManager_;
Instance* _instanceManager; Instance* instanceManager_;
DBus::BusDispatcher _dispatcher; DBus::BusDispatcher dispatcher_;
#if USE_NETWORKMANAGER #if USE_NETWORKMANAGER
NetworkManager* _networkManager; NetworkManager* networkManager_;
#endif #endif
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
void void
ManagerImpl::registerAccounts() ManagerImpl::registerAccounts()
{ {
for (AccountMap::iterator iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { for (AccountMap::iterator iter = accountMap_.begin(); iter != accountMap_.end(); ++iter) {
Account *a = iter->second; Account *a = iter->second;
if (!a) if (!a)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment