Fix release (and double release) of mu2e PCIe device by destructors f…#130
Merged
rrivera747 merged 4 commits intodevelopfrom Mar 17, 2026
Merged
Conversation
…rom class hierarchy of CFO/DTC
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the release (and double release) of the mu2e PCIe device by moving cleanup logic into mu2edev::close() and calling it from the mu2edev destructor, removing redundant device_.close() calls from derived class destructors. It also adds munmap cleanup, improves version mismatch error handling for CFO, and adds diagnostic logging.
Changes:
- Moved
device_.close()fromCFOandDTC_RegistersandCFO_Registersdestructors intomu2edev::~mu2edev(), and enhancedclose()to properlymunmapbefore closing the file descriptor - Added try/catch around
std::stoulfor CFO version parsing (matching existing DTC pattern), with device index in error messages - Initialized
devfd_to-1and fixed the sentinel value check/reset from0to-1
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dtcInterfaceLib/mu2edev.h | Initialize devfd_ to -1 |
| dtcInterfaceLib/mu2edev.cpp | Add close() call in destructor, add munmap in close(), use -1 sentinel for devfd_, add logging |
| dtcInterfaceLib/CFOandDTC_Registers.cpp | Remove device_.close() from destructor (now handled by mu2edev) |
| cfoInterfaceLib/CFO_Registers.cpp | Remove device_.close() from destructor; add robust version parsing with try/catch |
| dtcInterfaceLib/DTC_Registers.cpp | Add device index to version mismatch error messages, bump destructor log level |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
eflumerf
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…rom class hierarchy of CFO/DTC