Skip to content

Conversation

@marc1uk
Copy link
Contributor

@marc1uk marc1uk commented Feb 19, 2025

Check requested control exists in templated GetValue method.

Note that this simply returns a default-constructed value, but does not communicate to the user that the requested control was not found. This could lead to some subtle and hard-to-find bugs if typos are made in Get calls. :(

Similar behaviour is affected by the SlowControlElement class GetValue method.

Check requested control exists in templated GetValue method
@marc1uk marc1uk changed the title bugfix in SlowControlCollection.h important safety check in SlowControlCollection.h Feb 19, 2025
@marc1uk
Copy link
Contributor Author

marc1uk commented Feb 19, 2025

Alejandro believes his error may not be from a stray templated Get call generating an invalid entry in SC_vars, but rather due to memory exhaustion from creating too many SlowControlElements. Pretty unlikely on a server/desktop, but in embedded environments I suppose it's possible.
Would require an additional check on SlowControlCollection::Add for new calls that return nullptr, erasing the corresponding map entry. Not sure how we feed either of these errors back to the user, though.

@brichards64 brichards64 merged commit f56d059 into ToolDAQ:main Mar 6, 2025
1 check failed
@marc1uk marc1uk deleted the patch-5 branch November 20, 2025 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants