Commit 6d447410 authored by Don Gagne's avatar Don Gagne

Fix UAS unit test

Destroyed signal must have been working incorrectly in the past.
parent 6d7fb36a
......@@ -301,7 +301,6 @@ void UASUnitTest::signalWayPoint_test()
void UASUnitTest::signalUASLink_test()
{
QSignalSpy spy(uas, SIGNAL(modeChanged(int,QString,QString)));
uas->setMode(2, 0);
QCOMPARE(spy.count(), 0);// not solve for UAS not receiving message from UAS
......@@ -347,7 +346,7 @@ void UASUnitTest::signalUASLink_test()
delete link2;
QCOMPARE(LinkManager::instance()->getLinks().count(), 1);
QCOMPARE(uas->getLinks()->count(), 2);
QCOMPARE(uas->getLinks()->count(), 1);
QCOMPARE(static_cast<LinkInterface*>(LinkManager::instance()->getLinks().at(0))->getId(),
static_cast<LinkInterface*>(uas->getLinks()->at(0))->getId());
......
......@@ -3375,8 +3375,13 @@ void UAS::addLink(LinkInterface* link)
void UAS::removeLink(QObject* object)
{
// Be careful of the fact that by the time this signal makes it through the queue
// the link object has already been destructed.
links->removeAt(links->indexOf((LinkInterface*)object));
// the link object has already been destructed. So no dynamic_cast for example.
LinkInterface* link = (LinkInterface*)object;
int index = links->indexOf(link);
Q_ASSERT(index != -1);
links->removeAt(index);
}
/**
......
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