Conversation
rasapala
left a comment
There was a problem hiding this comment.
find other classes with missing definitions
| it->second->shutdown(); | ||
| } | ||
|
|
||
| class ModulesShutdownGuard { |
There was a problem hiding this comment.
Pull request overview
This PR implements the "Rule of 4" for RAII guard classes by explicitly deleting copy and move constructors and assignment operators. This prevents accidental copying or moving of resource management objects that should have unique ownership semantics.
Changes:
- Added deleted special member functions to
ModulesShutdownGuardclass - Added deleted special member functions to
OvmsExitGuardclass - Added deleted special member functions to
V3StreamCallbackResourceGuardclass
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/server.cpp | Added deleted copy/move constructors and assignment operators to ModulesShutdownGuard and OvmsExitGuard guard classes |
| src/http_rest_api_handler.cpp | Added deleted copy/move constructors and assignment operators to V3StreamCallbackResourceGuard class |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| OvmsExitGuard& operator=(OvmsExitGuard&&) = delete; | ||
| OvmsExitGuard(OvmsExitGuard&&) = delete; |
There was a problem hiding this comment.
The order of deleted special member functions is inconsistent. The move assignment operator appears before the move constructor, while in ModulesShutdownGuard the move constructor appears before the move assignment operator. For consistency and readability, follow the canonical order: copy constructor, copy assignment, move constructor, move assignment.
| OvmsExitGuard& operator=(OvmsExitGuard&&) = delete; | |
| OvmsExitGuard(OvmsExitGuard&&) = delete; | |
| OvmsExitGuard(OvmsExitGuard&&) = delete; | |
| OvmsExitGuard& operator=(OvmsExitGuard&&) = delete; |
No description provided.