[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:26:48 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=46f2fcf
The following commit has been merged in the master branch:
commit 46f2fcfbce167940fe39aa6fbe2f54e7ae8de07e
Author: Albert Vaca <albertvaka at gmail.com>
Date: Fri Aug 16 07:20:34 2013 +0200
Fixed crash due tu accessing already deleted link
---
daemon/linkproviders/broadcasttcplinkprovider.cpp | 39 +++++++++++------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/daemon/linkproviders/broadcasttcplinkprovider.cpp b/daemon/linkproviders/broadcasttcplinkprovider.cpp
index 4a18beb..8e4646a 100644
--- a/daemon/linkproviders/broadcasttcplinkprovider.cpp
+++ b/daemon/linkproviders/broadcasttcplinkprovider.cpp
@@ -138,12 +138,6 @@ void BroadcastTcpLinkProvider::connected()
TcpDeviceLink* dl = new TcpDeviceLink(id, this, socket);
- connect(dl, SIGNAL(destroyed(QObject*)),
- this, SLOT(deviceLinkDestroyed(QObject*)));
-
- QMap< QString, DeviceLink* >::iterator oldLinkIterator = links.find(id);
- DeviceLink* oldLink = (oldLinkIterator == links.end())? 0 : oldLinkIterator.value();
-
NetworkPackage np2("");
NetworkPackage::createIdentityPackage(&np2);
@@ -154,15 +148,22 @@ void BroadcastTcpLinkProvider::connected()
qDebug() << "Handshaking done (i'm the existing device)";
- links[id] = dl;
+ connect(dl, SIGNAL(destroyed(QObject*)),
+ this, SLOT(deviceLinkDestroyed(QObject*)));
+
Q_EMIT onConnectionReceived(*np, dl);
- if (oldLink) {
+ QMap< QString, DeviceLink* >::iterator oldLinkIterator = links.find(id);
+ if (oldLinkIterator != links.end()) {
+ DeviceLink* oldLink = oldLinkIterator.value();
disconnect(oldLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
- delete oldLink;
+ oldLink->deleteLater();
+ links.erase(oldLinkIterator);
}
+ links[id] = dl;
+
} else {
//I think this will never happen
qDebug() << "Fallback (2), try reverse connection";
@@ -212,26 +213,24 @@ void BroadcastTcpLinkProvider::dataReceived()
const QString& id = np.get<QString>("deviceId");
TcpDeviceLink* dl = new TcpDeviceLink(id, this, socket);
+ qDebug() << "Handshaking done (i'm the new device)";
+
connect(dl, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
- QMap< QString, DeviceLink* >::iterator oldLinkIterator = links.find(id);
- DeviceLink* oldLink = (oldLinkIterator == links.end())? 0 : oldLinkIterator.value();
-
- links[id] = dl;
-
- //qDebug() << "BroadcastTcpLinkProvider creating link to device" << id << "(" << socket->peerAddress() << ")";
-
- qDebug() << "Handshaking done (i'm the new device)";
-
Q_EMIT onConnectionReceived(np, dl);
- if (oldLink) {
+ QMap< QString, DeviceLink* >::iterator oldLinkIterator = links.find(id);
+ if (oldLinkIterator != links.end()) {
+ DeviceLink* oldLink = oldLinkIterator.value();
disconnect(oldLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
- delete oldLink;
+ oldLink->deleteLater();
+ links.erase(oldLinkIterator);
}
+ links[id] = dl;
+
disconnect(socket,SIGNAL(readyRead()),this,SLOT(dataReceived()));
} else {
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list