Skip to content

Commit

Permalink
Fixed crashing on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
pchk committed Oct 17, 2017
1 parent a8d8c13 commit 971ff20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mumble/ServerHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ ServerHandler::ServerHandler() {
if (hQoS)
Connection::setQoS(hQoS);
#endif

connect(this, SIGNAL(pingRequested()), this, SLOT(sendPingInternal()), Qt::QueuedConnection);
}

ServerHandler::~ServerHandler() {
Expand Down Expand Up @@ -447,6 +449,10 @@ void ServerHandler::setSslErrors(const QList<QSslError> &errors) {
}

void ServerHandler::sendPing() {
emit pingRequested();
}

void ServerHandler::sendPingInternal() {
ConnectionPtr connection(cConnection);
if (!connection)
return;
Expand Down Expand Up @@ -688,6 +694,9 @@ void ServerHandler::serverConnectionConnected() {
}

qusUdp = new QUdpSocket(this);
if (qusUdp == nullptr) {
qFatal("ServerHandler: qusUdp is unexpectedly a null addr");
}
if (g.s.bUdpForceTcpAddr) {
qusUdp->bind(qhaLocal, 0);
} else {
Expand All @@ -698,7 +707,7 @@ void ServerHandler::serverConnectionConnected() {
}
}

connect(qusUdp, SIGNAL(readyRead()), this, SLOT(udpReady()));
connect(qusUdp, SIGNAL(readyRead()), this, SLOT(udpReady()), Qt::QueuedConnection);

if (g.s.bQoS) {

Expand Down
3 changes: 3 additions & 0 deletions src/mumble/ServerHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class ServerHandler : public QThread {
signals:
void disconnected(QAbstractSocket::SocketError, QString reason);
void connected();
void pingRequested();
protected slots:
void message(unsigned int, const QByteArray &);
void serverConnectionConnected();
Expand All @@ -146,6 +147,8 @@ class ServerHandler : public QThread {
void setSslErrors(const QList<QSslError> &);
void udpReady();
void hostnameResolved();
private slots:
void sendPingInternal();
public slots:
void sendPing();
};
Expand Down

0 comments on commit 971ff20

Please sign in to comment.