From 30745d049f5a2ba72eb314a76c7067adafa52161 Mon Sep 17 00:00:00 2001
From: Robert Loehning <robert.loehning@nokia.com>
Date: Tue, 20 Oct 2009 17:51:10 +0200
Subject: [PATCH] Trk: Added preventive disconnects.

Reviewed-by: hjk
---
 src/plugins/debugger/gdb/trkgdbadapter.cpp | 1 +
 src/shared/trk/launcher.cpp                | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp
index e1aae8b843f..16f434a4954 100644
--- a/src/plugins/debugger/gdb/trkgdbadapter.cpp
+++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp
@@ -413,6 +413,7 @@ void TrkGdbAdapter::waitForTrkConnect()
     }
 
     m_trkDevice.sendTrkInitialPing();
+    sendTrkMessage(0x02); // Disconnect, as trk might be still connected
     sendTrkMessage(0x01); // Connect
     sendTrkMessage(0x05, TrkCB(handleSupportMask));
     sendTrkMessage(0x06, TrkCB(handleCpuType));
diff --git a/src/shared/trk/launcher.cpp b/src/shared/trk/launcher.cpp
index 78f7df6f177..08af4a21535 100644
--- a/src/shared/trk/launcher.cpp
+++ b/src/shared/trk/launcher.cpp
@@ -150,6 +150,7 @@ bool Launcher::startServer(QString *errorMessage)
     if (!d->m_device.open(d->m_trkServerName, errorMessage))
         return false;
     d->m_device.sendTrkInitialPing();
+    d->m_device.sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected
     d->m_device.sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask));
     d->m_device.sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType));
     d->m_device.sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion));
-- 
GitLab