Skip to content

segfault in OnLobbyDataRetrieveSuccess #19

@grasmanek94

Description

@grasmanek94
void Unet::LobbyListListener::OnLobbyDataRetrieveSuccess(const galaxy::api::GalaxyID& lobbyID)
{
	auto it = std::find(m_listDataFetch.begin(), m_listDataFetch.end(), lobbyID);
	if (it != m_listDataFetch.end()) {
		m_listDataFetch.erase(it);
	}

	xg::Guid unetGuid(galaxy::api::Matchmaking()->GetLobbyData(lobbyID, "unet-guid"));
	if (!unetGuid.isValid()) {
		m_self->m_ctx->GetCallbacks()->OnLogWarn("[Galaxy] unet-guid is not valid!");
		LobbyDataUpdated();
		return;
	}

	ServiceID newEntryPoint;
	newEntryPoint.Service = ServiceType::Galaxy;
	newEntryPoint.ID = lobbyID.ToUint64();
	m_self->m_requestLobbyList->Data->AddEntryPoint(unetGuid, newEntryPoint); // ->Data == nullptr

	LobbyDataUpdated();
}

m_self->m_requestLobbyList->Data->AddEntryPoint(unetGuid, newEntryPoint); // ->Data == nullptr

Code doesn't hit BP on AddServiceRequest where Data is assigned:

		ServiceRequest* AddServiceRequest(Service* service)
		{
			auto newServiceRequest = new ServiceRequest;
			newServiceRequest->Data = &m_result;
			m_requests.emplace_back(newServiceRequest); // Not hit
			return newServiceRequest;
		}

Reproduced with the CLI example (--galaxy .. ..) with side A doing:
create test

side B:
list
list
list (... callback info shows lobbies)
data 0

(or wait also crashes)

Full modified CLI source here: https://github.com/grasmanek94/UniverseLAN/blob/feature/unet-tests/Source/TestCases/Source-unet/TestCase_unet_cli_a.cxx (I don't use GOG galaxy client, I use built-in username/pw login method).

Due the nature of my project I would be interested more in fixing it not only in the unet library (with a new release), but also try to find a way to make this work in the current application without forcing older games to update unet, if possible at all.
I can modify the behaviour of the GOG Galaxy SDK side (my own implementation) to facilitate that, but I'm unsure why in a real/official GOG Galaxy SDK this segfault happens when using the CLI demo.
The target SDK in this case is 1.139.2, didn't test other ones yet.

Edit: Okay so the breakpoint is hit today after starting a debugging session and it works, without making any changes to the CLI code. I think this needs more investigation. Could it be an bug in the GOG Galaxy SDK instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions