mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1119 Added some mem management improvements
This commit is contained in:
parent
79c13b55c5
commit
3f3245b749
@ -49,7 +49,9 @@ FlightLogManager::FlightLogManager(QObject *parent) :
|
||||
}
|
||||
|
||||
FlightLogManager::~FlightLogManager() {
|
||||
|
||||
while (!m_logEntries.isEmpty()) {
|
||||
delete m_logEntries.takeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
void addEntries(QQmlListProperty<ExtendedDebugLogEntry> *list, ExtendedDebugLogEntry *entry) {
|
||||
@ -76,7 +78,11 @@ QQmlListProperty<ExtendedDebugLogEntry> FlightLogManager::logEntries() {
|
||||
void FlightLogManager::clearAllLogs() {
|
||||
|
||||
//Clear on flight side
|
||||
m_logEntries.clear();
|
||||
|
||||
//Then delete locally
|
||||
while (!m_logEntries.isEmpty()) {
|
||||
delete m_logEntries.takeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
void FlightLogManager::retrieveLogs(int flightToRetrieve) {
|
||||
@ -85,7 +91,10 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve) {
|
||||
UAVObjectRequestHelper requestHelper;
|
||||
|
||||
//Get logs from flight side
|
||||
m_logEntries.clear();
|
||||
while (!m_logEntries.isEmpty()) {
|
||||
delete m_logEntries.takeFirst();
|
||||
}
|
||||
emit logEntriesChanged();
|
||||
|
||||
// Set up what to retrieve
|
||||
bool timedOut = false;
|
||||
@ -114,7 +123,6 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve) {
|
||||
m_flightLogEntry->getFlight() == flight && m_flightLogEntry->getEntry() == entry) {
|
||||
|
||||
//Ok, we retrieved the entry, and it was the correct one. clone it and add it to the list
|
||||
|
||||
ExtendedDebugLogEntry* logEntry = new ExtendedDebugLogEntry();
|
||||
logEntry->setObjectManager(m_objectManager);
|
||||
logEntry->setData(m_flightLogEntry->getData());
|
||||
|
Loading…
x
Reference in New Issue
Block a user