Commit bb01b594 authored by Lorenz Meier's avatar Lorenz Meier

Fix a minor bug on program shutdown with link deletion

parent 77bc952f
......@@ -206,9 +206,12 @@ QGCCore::~QGCCore()
mainWindow->close();
//mainWindow->deleteLater();
// Delete singletons
delete MainWindow::instance();
delete LinkManager::instance();
// First systems
delete UASManager::instance();
// then links
delete LinkManager::instance();
// Finally the main window
delete MainWindow::instance();
}
/**
......
......@@ -54,11 +54,10 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress
}
QGCXPlaneLink::~QGCXPlaneLink()
{ //do not disconnect unless it is connected.
//disconnectSimulation will delete the memory that was allocated for proces, terraSync and socket
if(connectState){
disconnectSimulation();
}
{
// if(connectState) {
// disconnectSimulation();
// }
}
/**
......
......@@ -1647,14 +1647,13 @@ void UAS::setMode(int mode)
*/
void UAS::sendMessage(mavlink_message_t message)
{
if (!LinkManager::instance()) return;
// Emit message on all links that are currently connected
foreach (LinkInterface* link, *links)
{
//qDebug() << "ITERATING THROUGH LINKS";
if (LinkManager::instance()->getLinks().contains(link))
{
sendMessage(link, message);
//qDebug() << "SENT MESSAGE";
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment