Commit 5af61d21 authored by Don Gagne's avatar Don Gagne

Correct ownership and deleteLater

parent 6f7ec666
...@@ -675,6 +675,7 @@ void ...@@ -675,6 +675,7 @@ void
QGCLogModel::append(QGCLogEntry* object) QGCLogModel::append(QGCLogEntry* object)
{ {
beginInsertRows(QModelIndex(), rowCount(), rowCount()); beginInsertRows(QModelIndex(), rowCount(), rowCount());
QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);
_logEntries.append(object); _logEntries.append(object);
endInsertRows(); endInsertRows();
emit countChanged(); emit countChanged();
...@@ -688,7 +689,7 @@ QGCLogModel::clear(void) ...@@ -688,7 +689,7 @@ QGCLogModel::clear(void)
beginRemoveRows(QModelIndex(), 0, _logEntries.count()); beginRemoveRows(QModelIndex(), 0, _logEntries.count());
while (_logEntries.count()) { while (_logEntries.count()) {
QGCLogEntry* entry = _logEntries.last(); QGCLogEntry* entry = _logEntries.last();
if(entry) delete entry; if(entry) entry->deleteLater();
_logEntries.removeLast(); _logEntries.removeLast();
} }
endRemoveRows(); endRemoveRows();
......
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