Skip to content

Commit

Permalink
Merge pull request #145 from cristian64/memory_leak_and_layoutchanged
Browse files Browse the repository at this point in the history
Memory leak and more specific model invalidation.
  • Loading branch information
dreamsyntax authored May 18, 2024
2 parents 061257b + f5359e2 commit d493afc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Source/GUI/MemWatcher/MemWatchModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void MemWatchModel::editEntry(MemWatchEntry* entry, const QModelIndex& index)
{
MemWatchTreeNode* node = static_cast<MemWatchTreeNode*>(index.internalPointer());
node->setEntry(entry);
emit layoutChanged();
emit dataChanged(index.siblingAtColumn(0), index.siblingAtColumn(columnCount({}) - 1));
}

void MemWatchModel::clearRoot()
Expand Down Expand Up @@ -572,8 +572,9 @@ bool MemWatchModel::dropMimeData(const QMimeData* data, Qt::DropAction action, i

void MemWatchModel::loadRootFromJsonRecursive(const QJsonObject& json)
{
beginResetModel();
m_rootNode->readFromJson(json);
emit layoutChanged();
endResetModel();
}

MemWatchModel::CTParsingErrors MemWatchModel::importRootFromCTFile(QFile* const CTFile,
Expand All @@ -584,15 +585,14 @@ MemWatchModel::CTParsingErrors MemWatchModel::importRootFromCTFile(QFile* const
parser.setTableStartAddress(CEStart);
MemWatchTreeNode* importedRoot = parser.parseCTFile(CTFile, useDolphinPointer);
if (importedRoot != nullptr)
{
beginResetModel();
delete m_rootNode;
m_rootNode = importedRoot;
endResetModel();
}

CTParsingErrors parsingErrors;
parsingErrors.errorStr = parser.getErrorMessages();
parsingErrors.isCritical = parser.hasACriticalErrorOccured();
if (!parsingErrors.isCritical)
emit layoutChanged();

return parsingErrors;
return {parser.getErrorMessages(), parser.hasACriticalErrorOccured()};
}

void MemWatchModel::writeRootToJsonRecursive(QJsonObject& json) const
Expand Down

0 comments on commit d493afc

Please sign in to comment.