Skip to content

Conversation

vryabokon1705
Copy link
Contributor

@vryabokon1705 vryabokon1705 commented Aug 15, 2025

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

  • Connect to vehicle
  • Open MAVLink Inspector
  • Select MAVLink message ( fe HIGHRES_IMU)
  • Plot values in different plots
  • Click MAVLink console
  • Repeat muiltiple times

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.

@vryabokon1705 vryabokon1705 marked this pull request as ready for review August 15, 2025 12:01
@HTRamsey HTRamsey requested a review from Copilot August 21, 2025 03:26
Copy link
Contributor

@Copilot Copilot AI left a 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.

@HTRamsey HTRamsey requested a review from Copilot August 21, 2025 04:47
Copy link
Contributor

@Copilot Copilot AI left a 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.

@HTRamsey HTRamsey requested a review from Copilot September 14, 2025 01:13
Copy link
Contributor

@Copilot Copilot AI left a 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);
}
Copy link
Contributor

@DonLakeFlyer DonLakeFlyer Sep 17, 2025

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.

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants