crash on SmartFox->CurrentIp()

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

bqlf1907
Posts: 25
Joined: 13 May 2013, 10:28

crash on SmartFox->CurrentIp()

Postby bqlf1907 » 03 Jun 2013, 07:19

i want to get currentIp,but crash on

Code: Select all

pSmartFox->CurrentIp()
Mazyod
Posts: 25
Joined: 04 Sep 2012, 16:05

Re: crash on SmartFox->CurrentIp()

Postby Mazyod » 03 Jun 2013, 21:36

Hello bqlf1907,

Could you please elaborate more, maybe include the crash logs? All we know, it could be that the pSmartFox object is NULL.
bqlf1907
Posts: 25
Joined: 13 May 2013, 10:28

Re: crash on SmartFox->CurrentIp()

Postby bqlf1907 » 04 Jun 2013, 02:01

Code: Select all

void SmartFox::Connect(string* host, long int port)
{
    .......
       //bitSwarm->Connect(&endpointAddress, endpointPort);
   //modify bqlf1907
   bitSwarm->Connect(new string(endpointAddress), endpointPort);
}

void BitSwarmClient::Connect(string* ip, unsigned short int port)
{
    lastIpAddress = ip;
    ......
}

BitSwarmClient::~BitSwarmClient()
{
        .........
        delete lastIpAddress;
   lastIpAddress = NULL;
        .........
}


lastIpAddress is a point in BitSwarmClient,and delete in destructor.
so i new ipAddress pass in BitSwarmClient::Connect;
then it's not crash when pMartFox->currentIp().
bqlf1907
Posts: 25
Joined: 13 May 2013, 10:28

Re: crash on SmartFox->CurrentIp()

Postby bqlf1907 » 04 Jun 2013, 02:08

by the way.

Code: Select all

void SmartFox::Initialize()
{
     ..............
     bitSwarm = new BitSwarmClient(this, service);
     ..............
}


but in destructor no delete bitSwarm;
Q:where delete bitSwarm?
MBagnati
Posts: 126
Joined: 12 Feb 2013, 10:57

Re: crash on SmartFox->CurrentIp()

Postby MBagnati » 11 Jun 2013, 09:04

Fixed in version 0.9.6

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 14 guests