Skip to content

Conversation

@ArekMiszcz
Copy link

@ArekMiszcz ArekMiszcz commented May 20, 2025

With current shape, an example is throwing segmentation fault error so people rising new issues.
This simple fix solving that problem into this example.

@CLAassistant
Copy link

CLAassistant commented May 20, 2025

CLA assistant check
All committers have signed the CLA.

@novabyte novabyte requested review from RicardRC and Copilot May 20, 2025 12:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a segmentation fault error by moving the declaration of the NRtDefaultClientListener out of the lambda, thereby ensuring its lifetime extends for the duration of the asynchronous callbacks.

  • Moved listener declaration to the outer scope.
  • Updated lambda capture list to include the listener.
Comments suppressed due to low confidence (1)

example/main.cpp:73

  • Ensure that the listener's lifetime covers the entire duration needed for asynchronous callbacks, as capturing it by reference may lead to lifetime issues if the surrounding scope ends early.
auto loginSucceededCallback = [&done, &connectSucceededCallback, &rtErrorCallback, &client, &rtClient, &listener](Nakama::NSessionPtr session) {

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.

4 participants