-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Camera: Cleanup CameraManager #13278
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
Conversation
e498418
to
00d4317
Compare
Should the prepareDelete do a camera manager stop now instead of nothing. Just to be safe? |
00d4317
to
297a91e
Compare
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
This PR refactors the CameraManager to fix a use-after-free issue in the RequestMessageTest by implementing a stop mechanism instead of deleting the manager entirely. The changes also include code reorganization and cleanup for better maintainability.
- Replaces
deleteCameraManager()
withstopCameraManager()
to gracefully stop camera requests during testing - Reorganizes Camera Manager code into a dedicated section within the Vehicle class for better maintainability
- Improves code quality through consistent formatting, explicit types, and safer memory management
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
test/Vehicle/RequestMessageTest.cc | Updated test to use stopCameraManager() instead of deleteCameraManager() to prevent use-after-free |
src/VideoManager/VideoManager.cc | Added include for MavlinkCameraControl header |
src/Vehicle/Vehicle.h | Reorganized camera manager declarations into dedicated section and updated API |
src/Vehicle/Vehicle.cc | Moved camera manager implementation to dedicated section and simplified lifecycle management |
src/QmlControls/QmlObjectListModel.h | Added isEmpty() convenience method |
src/Camera/QGCCameraManager.h | Refactored class structure with improved organization and added start/stop functionality |
src/Camera/QGCCameraManager.cc | Comprehensive refactor with improved error handling, memory safety, and code organization |
custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.h | Removed unused CustomCameraManager forward declaration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
297a91e
to
0380e70
Compare
@DonLakeFlyer so one question I have is the original code only removes one stale camera at a time in _checkForLostCameras, any reason not to iterate all of them? I guess it's just deferring the rest of the cleanup to 500ms later but I don't see why you wouldn't just perform the full loop. |
ef12add
to
ae4e191
Compare
ae4e191
to
4ec33ff
Compare
This should fix a use after free issue
Just stop requesting messages during the RequestMessageTest rather than deleting the manager itself.
Formatting fixes