Skip to content
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

[cameraserver] Add GetInstance() to all functions #5054

Merged

Conversation

PeterJohnson
Copy link
Member

GetInstance() is required to start the event listener that creates the network table entries.

This is a C++ only change; Java uses static's and thus doesn't need this.

GetInstance() is required to start the event listener that creates the
network table entries.
@PeterJohnson PeterJohnson requested a review from a team as a code owner February 5, 2023 18:31
@Starlight220
Copy link
Member

This solution seems rather fragile. Is there a better solution?

@PeterJohnson
Copy link
Member Author

PeterJohnson commented Feb 5, 2023

The right fix is to implement cscore's AddListener() immediate notification, but that's much too invasive of a change to do this year.

This fixes the common use cases, but doesn't fix all cases, as e.g. creating a UsbCamera manually before calling any CameraServer functions will still have the issue, but there's an easy workaround--call CameraServer::SetSize() prior to creating any cameras.

@PeterJohnson PeterJohnson merged commit 1f35750 into wpilibsuite:main Feb 5, 2023
@PeterJohnson PeterJohnson deleted the cameraserver-getinstance branch February 5, 2023 19:28
Starlight220 pushed a commit to Starlight220/allwpilib that referenced this pull request Mar 2, 2023
GetInstance() is required to start the event listener that creates the
network table entries.

This is a C++ only change; Java uses static's and thus doesn't need this.

The right fix is to implement cscore's AddListener() immediate notification,
but that's much too invasive of a change to do this year.

This fixes the common use cases, but doesn't fix all cases, as e.g. creating
a UsbCamera manually before calling any CameraServer functions will still
have the issue, but there's an easy workaround--call
CameraServer::SetSize() prior to creating any cameras.
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