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() ...@@ -206,9 +206,12 @@ QGCCore::~QGCCore()
mainWindow->close(); mainWindow->close();
//mainWindow->deleteLater(); //mainWindow->deleteLater();
// Delete singletons // Delete singletons
delete MainWindow::instance(); // First systems
delete LinkManager::instance();
delete UASManager::instance(); 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 ...@@ -54,11 +54,10 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress
} }
QGCXPlaneLink::~QGCXPlaneLink() QGCXPlaneLink::~QGCXPlaneLink()
{ //do not disconnect unless it is connected. {
//disconnectSimulation will delete the memory that was allocated for proces, terraSync and socket // if(connectState) {
if(connectState){ // disconnectSimulation();
disconnectSimulation(); // }
}
} }
/** /**
......
...@@ -1647,14 +1647,13 @@ void UAS::setMode(int mode) ...@@ -1647,14 +1647,13 @@ void UAS::setMode(int mode)
*/ */
void UAS::sendMessage(mavlink_message_t message) void UAS::sendMessage(mavlink_message_t message)
{ {
if (!LinkManager::instance()) return;
// Emit message on all links that are currently connected // Emit message on all links that are currently connected
foreach (LinkInterface* link, *links) foreach (LinkInterface* link, *links)
{ {
//qDebug() << "ITERATING THROUGH LINKS";
if (LinkManager::instance()->getLinks().contains(link)) if (LinkManager::instance()->getLinks().contains(link))
{ {
sendMessage(link, message); sendMessage(link, message);
//qDebug() << "SENT MESSAGE";
} }
else 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