forked from qt-creator/qt-creator
SSH: Fix some potential crashes.
Change-Id: I102e35c3dcd3725f357c91d9f0a77ab28d881b0d Reviewed-by: Oliver Wolff <oliver.wolff@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
This commit is contained in:
@@ -108,8 +108,10 @@ bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters
|
|||||||
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare
|
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare
|
||||||
|
|
||||||
SshConnection::SshConnection(const SshConnectionParameters &serverInfo)
|
SshConnection::SshConnection(const SshConnectionParameters &serverInfo)
|
||||||
: d(new Internal::SshConnectionPrivate(this, serverInfo))
|
|
||||||
{
|
{
|
||||||
|
doStaticInitializationsIfNecessary();
|
||||||
|
|
||||||
|
d = new Internal::SshConnectionPrivate(this, serverInfo);
|
||||||
connect(d, SIGNAL(connected()), this, SIGNAL(connected()),
|
connect(d, SIGNAL(connected()), this, SIGNAL(connected()),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(d, SIGNAL(dataAvailable(QString)), this,
|
connect(d, SIGNAL(dataAvailable(QString)), this,
|
||||||
@@ -202,8 +204,6 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
|
|||||||
m_connParams(serverInfo), m_error(SshNoError), m_ignoreNextPacket(false),
|
m_connParams(serverInfo), m_error(SshNoError), m_ignoreNextPacket(false),
|
||||||
m_conn(conn)
|
m_conn(conn)
|
||||||
{
|
{
|
||||||
doStaticInitializationsIfNecessary();
|
|
||||||
|
|
||||||
setupPacketHandlers();
|
setupPacketHandlers();
|
||||||
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
|
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
|
||||||
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
|
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
|
||||||
|
@@ -154,7 +154,7 @@ public:
|
|||||||
if (doDelete) {
|
if (doDelete) {
|
||||||
disconnect(connection, 0, this, 0);
|
disconnect(connection, 0, this, 0);
|
||||||
m_deprecatedConnections.removeAll(connection);
|
m_deprecatedConnections.removeAll(connection);
|
||||||
delete connection;
|
connection->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,8 @@ GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
|
|||||||
|
|
||||||
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
||||||
{
|
{
|
||||||
delete d->connection;
|
if (d->connection)
|
||||||
|
d->connection->deleteLater();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +187,12 @@ void GenericLinuxDeviceTester::handlePortListReady()
|
|||||||
void GenericLinuxDeviceTester::setFinished(TestResult result)
|
void GenericLinuxDeviceTester::setFinished(TestResult result)
|
||||||
{
|
{
|
||||||
d->state = Inactive;
|
d->state = Inactive;
|
||||||
disconnect(d->connection, 0, this, 0);
|
|
||||||
disconnect(&d->portsGatherer, 0, this, 0);
|
disconnect(&d->portsGatherer, 0, this, 0);
|
||||||
delete d->connection;
|
if (d->connection) {
|
||||||
|
disconnect(d->connection, 0, this, 0);
|
||||||
|
d->connection->deleteLater();
|
||||||
d->connection = 0;
|
d->connection = 0;
|
||||||
|
}
|
||||||
emit finished(result);
|
emit finished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,6 +69,7 @@ RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
|
|||||||
|
|
||||||
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
|
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -167,7 +167,8 @@ RemoteValgrindProcess::RemoteValgrindProcess(QSsh::SshConnection *connection, QO
|
|||||||
|
|
||||||
RemoteValgrindProcess::~RemoteValgrindProcess()
|
RemoteValgrindProcess::~RemoteValgrindProcess()
|
||||||
{
|
{
|
||||||
delete m_connection;
|
if (m_connection)
|
||||||
|
m_connection->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteValgrindProcess::isRunning() const
|
bool RemoteValgrindProcess::isRunning() const
|
||||||
|
Reference in New Issue
Block a user