Skip to content

Conversation

DonLakeFlyer
Copy link
Contributor

* Remove dangling references to chart controllers
* Also modified to improve readability
@DonLakeFlyer
Copy link
Contributor Author

DonLakeFlyer commented Sep 21, 2025

@vryabokon1705 Can you take a look at this? Both from a review standpoint as well as a testing and trying to repro the crash standpoint? The previous existing code for chart controllers was just a huge mess. There was no reason I could find the need to manage these dynamically. They should just work like other c++ controllers and be directly associated/created with the control. I believe this removes the possibility of crashing on in correct chart controller referencing. But I was not able to reproduce the crash you were seeing although I could understand how it could happen.

That said this charting code is still a big mess and this only fixes one aspect of it. The fact that it tries to support multi-vehicle and doesn't correctly deal with vehicles going away will cause other crashes in those cases. This code needs further modification to remove support for multi-vehicle since it's hopeless to try to fix that given all the reach-around to other objects it has embedded in it. I'm going to deal with that in another pull.

@DonLakeFlyer
Copy link
Contributor Author

@vryabokon1705 When you saw it crashing, was it referencing a chart controller or was it crashing on a reference to a message field?

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

This PR cleans up the MAVLink inspector code to prevent crashing by removing dangling references to chart controllers and improves code readability. The changes eliminate the central chart management system in favor of a more direct property-based approach.

  • Removes the createChart() and deleteChart() methods from MAVLinkInspectorController that could cause dangling references
  • Refactors MAVLinkChart to use required properties instead of nullable chart controller references
  • Improves variable naming consistency throughout the codebase for better readability

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/QmlControls/MAVLinkChart.qml Refactored to use required properties and removed chart controller creation/deletion logic
src/AnalyzeView/MAVLinkMessageField.h Renamed parameter from chart to chartController for consistency
src/AnalyzeView/MAVLinkMessageField.cc Updated variable names from _chart to _chartController for consistency
src/AnalyzeView/MAVLinkInspectorPage.qml Added required properties to chart instances and improved variable naming
src/AnalyzeView/MAVLinkInspectorController.h Removed chart management properties and methods
src/AnalyzeView/MAVLinkInspectorController.cc Removed chart creation/deletion methods and cleaned up logging category
src/AnalyzeView/MAVLinkChartController.h Changed from factory-created to QML-instantiated with required properties
src/AnalyzeView/MAVLinkChartController.cc Updated constructor and added setter for inspector controller

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

class MAVLinkChartController : public QObject
{
Q_OBJECT
QML_ELEMENT
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing QML_UNCREATABLE(\"\") makes this type creatable from QML, but the constructor now requires parameters that can't be provided from QML creation. Consider keeping QML_UNCREATABLE or adding a default constructor that handles uninitialized state gracefully.

Suggested change
QML_ELEMENT
QML_UNCREATABLE("Cannot be created from QML. Use factory or set required properties.")

Copilot uses AI. Check for mistakes.

@vryabokon1705
Copy link
Contributor

When you saw it crashing, was it referencing a chart controller or was it crashing on a reference to a message field?

Hi. Looks like it referencing a chart controller

@vryabokon1705
Copy link
Contributor

Can you take a look at this

Ok, let I try it

@vryabokon1705
Copy link
Contributor

Hi. I am not able to reproduce the crash issue with this branch. It is Ok from my point of view.

I uploaded video to show how you can reproduce it on the master branch.

Screencast.from.2025-09-22.11-57-42.mp4

@DonLakeFlyer
Copy link
Contributor Author

@vryabokon1705 Thanks so much for the help on this

@DonLakeFlyer DonLakeFlyer merged commit 57e8167 into master Sep 22, 2025
18 checks passed
@DonLakeFlyer DonLakeFlyer deleted the InspectorCharts branch September 22, 2025 16:00
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