Dedupe Q_EMIT

This commit is contained in:
Albert Vaca Cintora 2024-05-19 15:49:16 +02:00
parent 9a39eaa237
commit 983788e5c9
No known key found for this signature in database

View file

@ -89,6 +89,8 @@ void BluetoothLinkProvider::connectError()
void BluetoothLinkProvider::addLink(BluetoothDeviceLink *deviceLink, const QString &deviceId)
{
Q_EMIT onConnectionReceived(deviceLink);
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::addLink executed";
if (mLinks.contains(deviceId)) {
delete mLinks.take(deviceId); // not calling deleteLater because this triggers onLinkDestroyed
@ -217,8 +219,6 @@ void BluetoothLinkProvider::clientIdentityReceived(const QBluetoothAddress &peer
if (success) {
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider Handshaking done (I'm the new device)";
Q_EMIT onConnectionReceived(deviceLink);
// We kill any possible link from this same device
addLink(deviceLink, deviceInfo.id);
@ -312,8 +312,6 @@ void BluetoothLinkProvider::serverDataReceived(const QBluetoothAddress &peer, QS
DeviceInfo deviceInfo = deviceInfo.FromIdentityPacketAndCert(receivedPacket, receivedCertificate);
BluetoothDeviceLink *deviceLink = new BluetoothDeviceLink(deviceInfo, this, mSockets[peer], socket);
Q_EMIT onConnectionReceived(deviceLink);
addLink(deviceLink, deviceInfo.id);
}