mirror of
https://invent.kde.org/network/krfb
synced 2024-07-08 12:05:49 +00:00
Fix: KRFB crashes when closed during pending connection
This commit is contained in:
parent
a1de26dde7
commit
ad79d51e8b
|
@ -41,10 +41,13 @@ struct PendingInvitationsRfbClient::Private
|
|||
bool askOnConnect;
|
||||
};
|
||||
|
||||
static void clientGoneHookNoop(rfbClientPtr cl) { Q_UNUSED(cl); }
|
||||
|
||||
PendingInvitationsRfbClient::PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent) :
|
||||
PendingRfbClient(client, parent),
|
||||
d(new Private(client))
|
||||
{
|
||||
d->client->clientGoneHook = clientGoneHookNoop;
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, SIGNAL(activated(int)),
|
||||
|
@ -83,8 +86,6 @@ void PendingInvitationsRfbClient::processNewClient()
|
|||
}
|
||||
}
|
||||
|
||||
static void clientGoneHookNoop(rfbClientPtr cl) { Q_UNUSED(cl); }
|
||||
|
||||
void PendingInvitationsRfbClient::onSocketActivated()
|
||||
{
|
||||
//Process not only one, but all pending messages.
|
||||
|
@ -110,7 +111,6 @@ void PendingInvitationsRfbClient::onSocketActivated()
|
|||
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||
//from the server manager and will call deleteLater() to delete it
|
||||
if (d->client->sock == -1) {
|
||||
d->client->clientGoneHook = clientGoneHookNoop;
|
||||
kDebug() << "disconnected from socket signal";
|
||||
d->notifier->setEnabled(false);
|
||||
rfbClientConnectionGone(d->client);
|
||||
|
|
|
@ -103,6 +103,11 @@ void RfbClient::closeConnection()
|
|||
rfbClientConnectionGone(d->client);
|
||||
}
|
||||
|
||||
rfbClientPtr RfbClient::getRfbClientPtr()
|
||||
{
|
||||
return d->client;
|
||||
}
|
||||
|
||||
void RfbClient::handleKeyboardEvent(bool down, rfbKeySym keySym)
|
||||
{
|
||||
if (d->controlEnabled) {
|
||||
|
|
|
@ -51,6 +51,7 @@ Q_SIGNALS:
|
|||
protected:
|
||||
friend class RfbServer; //the following event handling methods are called by RfbServer
|
||||
|
||||
rfbClientPtr getRfbClientPtr();
|
||||
virtual void handleKeyboardEvent(bool down, rfbKeySym keySym);
|
||||
virtual void handleMouseEvent(int buttonMask, int x, int y);
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ void RfbServer::pendingClientFinished(RfbClient *client)
|
|||
kDebug();
|
||||
if (client) {
|
||||
RfbServerManager::instance()->addClient(client);
|
||||
client->getRfbClientPtr()->clientGoneHook = clientGoneHook;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +237,6 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
|||
connect(pendingClient, SIGNAL(finished(RfbClient*)),
|
||||
server, SLOT(pendingClientFinished(RfbClient*)));
|
||||
|
||||
cl->clientGoneHook = clientGoneHook;
|
||||
return RFB_CLIENT_ON_HOLD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user