-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix mavlink inspector crash #13309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mavlink inspector crash #13309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
auto chartObject = _charts->get(i); | ||
MAVLinkChartController* chart = dynamic_cast<MAVLinkChartController*>(chartObject); | ||
deleteChart(chart); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this fixes a problem? As far as I can tell it ends up being functionally the same thing. The only diiference is that chartsChanged is not signalled. But given the fact this is happening during destruction that should be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps to prevent trying to draw the chart, which was already deleted, but the list has not been clear yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How, given the fact that it is functionally equivalent to the previous code? Is it related to the chartsChanged signalling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void QmlObjectListModel::clearAndDeleteContents()
{
for (int i=0; i<_objectList.count(); i++) {
_objectList[i]->deleteLater();
}
clear();
}
In this method, we first iterate over the list and delete objects, but pointers still exist. And during this process, before _objectList is cleared, we can try to draw the chart, which can lead to a null pointer exception
Fix MAVLink Inspector crash
Description
Fixes unexpected crash when charts plotting selected in Mavlink Inspector and user selected some other "Analize Tools" page
Test Steps
Checklist:
Related Issue
13077
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.