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

* #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 {
* Get the voiplink pointer
* @return VoIPLink* the pointer or 0
*/
VoIPLink* getVoIPLink() const {
VoIPLink* getVoIPLink() {
return link_;
}
......
......@@ -37,45 +37,45 @@
#include "audio/mainbuffer.h"
Conference::Conference()
: _id(Manager::instance().getNewCallID())
, _confState(ACTIVE_ATTACHED)
: id_(Manager::instance().getNewCallID())
, confState_(ACTIVE_ATTACHED)
{
Recordable::initRecFileName(_id);
Recordable::initRecFileName(id_);
}
int Conference::getState() const
{
return _confState;
return confState_;
}
void Conference::setState(ConferenceState state)
{
_confState = state;
confState_ = state;
}
void Conference::add(const std::string &participant_id)
{
_participants.insert(participant_id);
participants_.insert(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)
{
for (ParticipantSet::iterator iter = _participants.begin();
iter != _participants.end(); ++iter)
for (ParticipantSet::iterator iter = participants_.begin();
iter != participants_.end(); ++iter)
if (participant_id != *iter)
Manager::instance().getMainBuffer()->bindCallID(participant_id, *iter);
Manager::instance().getMainBuffer()->bindCallID(participant_id);
}
std::string Conference::getStateStr()
std::string Conference::getStateStr() const
{
switch (_confState) {
switch (confState_) {
case ACTIVE_ATTACHED:
return "ACTIVE_ATTACHED";
case ACTIVE_DETACHED:
......@@ -95,7 +95,7 @@ std::string Conference::getStateStr()
ParticipantSet Conference::getParticipantList() const
{
return _participants;
return participants_;
}
bool Conference::setRecording()
......@@ -105,19 +105,18 @@ bool Conference::setRecording()
Recordable::recAudio.setRecording();
MainBuffer *mbuffer = Manager::instance().getMainBuffer();
ParticipantSet::iterator iter;
std::string process_id = Recordable::recorder.getRecorderID();
std::string process_id(Recordable::recorder.getRecorderID());
// start recording
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);
Recordable::recorder.start();
} 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);
......@@ -125,3 +124,12 @@ bool Conference::setRecording()
return recordStatus;
}
std::string Conference::getRecFileId() const {
return getConfID();
}
std::string Conference::getConfID() const {
return id_;
}
......@@ -49,9 +49,7 @@ class Conference: public Recordable {
/**
* Return the conference id
*/
std::string getConfID() const {
return _id;
}
std::string getConfID() const;
/**
* Return the current conference state
......@@ -66,7 +64,7 @@ class Conference: public Recordable {
/**
* Return a string description of the conference state
*/
std::string getStateStr();
std::string getStateStr() const;
/**
* Add a new participant to the conference
......@@ -91,31 +89,18 @@ class Conference: public Recordable {
/**
* Get recording file ID
*/
std::string getRecFileId() const {
return getConfID();
}
std::string getRecFileId() const;
/**
* Start/stop recording toggle
*/
virtual bool setRecording();
private:
std::string id_;
/**
* Unique ID of the conference
*/
std::string _id;
/**
* Conference state
*/
ConferenceState _confState;
ConferenceState confState_;
/**
* List of participant ids
*/
ParticipantSet _participants;
ParticipantSet participants_;
};
#endif
......@@ -29,7 +29,7 @@
*/
#include <cstdlib>
#include <dbusmanager.h>
#include "dbusmanager.h"
#include "global.h"
#include "manager.h"
#include "instance.h"
......@@ -42,43 +42,43 @@ DBusManager::DBusManager()
{
try {
DBus::_init_threading();
DBus::default_dispatcher = &_dispatcher;
DBus::default_dispatcher = &dispatcher_;
DBus::Connection sessionConnection = DBus::Connection::SessionBus();
sessionConnection.request_name("org.sflphone.SFLphone");
_callManager = new CallManager(sessionConnection);
_configurationManager = new ConfigurationManager(sessionConnection);
_instanceManager = new Instance(sessionConnection);
callManager_ = new CallManager(sessionConnection);
configurationManager_ = new ConfigurationManager(sessionConnection);
instanceManager_ = new Instance(sessionConnection);
#ifdef USE_NETWORKMANAGER
DBus::Connection systemConnection = DBus::Connection::SystemBus();
_networkManager = new NetworkManager(systemConnection, "/org/freedesktop/NetworkManager", "");
networkManager_ = new NetworkManager(systemConnection, "/org/freedesktop/NetworkManager", "");
#endif
} catch (const DBus::Error &err) {
_error("%s: %s, exiting\n", err.name(), err.what());
::exit(1);
::exit(EXIT_FAILURE);
}
}
DBusManager::~DBusManager()
{
#ifdef USE_NETWORKMANAGER
delete _networkManager;
delete networkManager_;
#endif
delete _instanceManager;
delete _configurationManager;
delete _callManager;
delete instanceManager_;
delete configurationManager_;
delete callManager_;
}
void DBusManager::exec()
{
_dispatcher.enter();
dispatcher_.enter();
}
void
DBusManager::exit()
{
_dispatcher.leave();
dispatcher_.leave();
}
......@@ -43,23 +43,23 @@ class DBusManager {
DBusManager();
~DBusManager();
CallManager * getCallManager() const {
return _callManager;
CallManager * getCallManager() {
return callManager_;
};
ConfigurationManager * getConfigurationManager() const {
return _configurationManager;
ConfigurationManager * getConfigurationManager() {
return configurationManager_;
};
void exec();
void exit();
private:
CallManager* _callManager;
ConfigurationManager* _configurationManager;
Instance* _instanceManager;
DBus::BusDispatcher _dispatcher;
CallManager* callManager_;
ConfigurationManager* configurationManager_;
Instance* instanceManager_;
DBus::BusDispatcher dispatcher_;
#if USE_NETWORKMANAGER
NetworkManager* _networkManager;
NetworkManager* networkManager_;
#endif
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -49,7 +49,7 @@
void
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;
if (!a)
......
Markdown is supported
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