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

check event callback before execution #1790

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

rex-schilasky
Copy link
Contributor

Description

eCAL service client is offering event callback functionality. Like this

const eCAL::service::ClientSession::EventCallbackT event_callback = []
  (eCAL::service::ClientEventType /*event*/, const std::string& /*message*/) -> void
   {
   };
client_session = client_manager->create_client(protocol_version, endpoint_list, event_callback);

If the event callback logic is not relevant for your use case I would expect to just pass a nullptr like this

client_session = client_manager->create_client(protocol_version, endpoint_list, nullptr);

but this leads to a crash.

Related issues

None

Cherry-pick to

  • none

@rex-schilasky rex-schilasky marked this pull request as ready for review November 12, 2024 10:57
@rex-schilasky rex-schilasky added the cherry-pick-to-NONE Don't cherry-pick these changes label Nov 12, 2024
Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

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

Actually, I don't necessarily expect that you can pass a nullptr, you could just pass an empty lambda.
But I guess at least it would need to be documented.

On the other hand, you should't be able to use API incorrectly, so I guess a check is not too bad.

@rex-schilasky rex-schilasky merged commit 80f7c21 into master Nov 12, 2024
20 of 22 checks passed
@rex-schilasky rex-schilasky deleted the hotfix/ecal-service-event-callback-check branch November 12, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-NONE Don't cherry-pick these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants