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

Only remove callback when a tag handle was succesfully created. #433

Merged
merged 3 commits into from
Jan 29, 2025
Merged

Conversation

timyhac
Copy link
Collaborator

@timyhac timyhac commented Jan 25, 2025

No description provided.

var result = (Status)_native.plc_tag_destroy(nativeTagHandle);
ThrowIfStatusNotOk(result);
{
RemoveCallback();
Copy link
Collaborator Author

@timyhac timyhac Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyle-github - this is the method that is used to tear down the tag either explicitly or implicitly by the garbage collector.

Previously, this code was checking that neither removing the event callback, nor destroying the tag, returned an error code, and if so would throw an exception. I'm not sure if there are any valid reasons for return an error code (other than bugs in the wrapper or core library), and I believe there is no recourse if either fail.

The new code fixes the bug that was there (found in #432) and also ignores any other errors that might occur.

Your thoughts?

@timyhac timyhac merged commit 0fdbc61 into main Jan 29, 2025
2 checks passed
@timyhac timyhac deleted the #432 branch January 29, 2025 07:40
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.

1 participant