discord-rpc icon indicating copy to clipboard operation
discord-rpc copied to clipboard

EXC_BAD_ACCESS on bool BaseConnection::Open()

Open Lyceion opened this issue 3 years ago • 0 comments

Hello everyone. I have a problem. I'm trying to test integration of discord-rpc on my program. Currently devolping on "MacOSX, BigSur 11.2.3". Added:

  • connection_unix.cpp
  • connection.h
  • msg_queue.h
  • backoff.h
  • discord_register_osx.m
  • discord_rpc.cpp
  • rpc_connection.cpp
  • rpc_connection.h
  • serialization.cpp
  • serialization.h with rapidjson from tencent.

Also included all includings. And it is compiling with ne errors. But when i run program, it has bad access on BaseConnection::Open(). And it returns self, this NULL as you can see on screenshot bellow. img

Also initializing RPC with:

void DiscordRPC::StartDiscordRPC(){
    DiscordEventHandlers event_handler;
    memset(&event_handler, 0, sizeof(event_handler));
    Discord_Initialize("clientID", &event_handler, 1, "123");
    UpdateDiscordRPC();
}

void DiscordRPC::UpdateDiscordRPC()
{
    DiscordRichPresence discordPresence;
    memset(&discordPresence, 0, sizeof(discordPresence));
    discordPresence.state = "test";
    discordPresence.details = "test";
    discordPresence.largeImageKey = "picmin";
    discordPresence.largeImageText = "test";
    discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657";
    discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= ";
    Discord_UpdatePresence(&discordPresence);
}

Calling StartDiscordRPC() in program start for once and calling UpdateDiscordRPC() on my program's update event. Program crashes from start. Even before calling UpdateDiscordRPC().

Lyceion avatar Mar 31 '21 13:03 Lyceion