SFSBUddyManager crash after connection is close.

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

SFSBUddyManager crash after connection is close.

Post by mmilen »

See the Attached file. The error comes up when the connection is closed.

The connection is close like this.


[self.client disconnect];
self.client=nil;


client is a property declared like this

@property (retain) SmartFox2XClient *client;


Although my project is ARC , all docs show, that it is safe to use a pre complied NON-ARC Framework.
Attachments
Screen Shot 2012-06-17 at 11.06.11 PM.png
(213.06 KiB) Not downloaded yet
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by A51Integrated »

Try not setting self.client=nil; - that can cause issues. Setting something to nil calls the setter, which will release the old value, set the member to nil, and possibly do other things.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Same error . This is how client is initialized


self.client = [[MySmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self];
[self.client loadConfig:@"config.xml" connectOnSuccess:YES];
self.client.logger.loggingLevel = LogLevel_ERROR;


The error goes away if I don;t initBuddyList.
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Legally I can share the project code. Can you legally share the API source code?

I
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Legally i can't share the project code.
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by A51Integrated »

How are you initializing the buddy list?
A51 Integrated
http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

onLogin event, after successful login i do : [self.client send:[InitBuddyListRequest request]];
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by A51Integrated »

We are unable to replicate this error. Client connects, logs in, initializes Buddy Manager, then logs out OR disconnects, and the client is shutdown gracefully. Reconnection at that point is possible.

Are you releasing any part of the client?
A51 Integrated
http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

I tries the example Connection app and added Buddy init call and it seems to be fine.

In my project the only time I use Buddy list is when building the table list, I show player's buddies in color.

if ([[[[NetworkProtocol np] client] buddyManager] getBuddyByName:[self.roomList getTableProperty:@"ssn" forRow:section]]!=nil)

NetworkProtocol is a singleton class , that handles game logic and holds a pointer (via property) to the SFSSmarFoxClient. I check to see of buddy exist and that's it.
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Something interesting. When I set a break point at -[SmartFox2XClient setBuddyManager:] in the Connection example , that break is hit twice. First when SFSclient is initialized and then on disconnect.

In My project that break point is hit only once on client init. On Disconnect debugger does not stop there altho it is going through it.
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Further looking into the issue it seems to occur only when the loved in user has buddies. I logged in with a user with no bodies and all works like a charm. Somewhere in the code that fills in the buddy list there is a bug.
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

Some more findings. If the I assign and retain [[[[NetworkProtocol np] client] buddyManager] buddyList] to a NSArray property. I can disconnect without the error. But then comes up the issue from my other buddy related ticket.

In the past I have help SFS people identified bugs and provided some fixes. Please share the source for the API.
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by A51Integrated »

I'm quite certain this issue has little to do with the API itself but rather the way in which you are managing memory with the client. The Buddy Manager code is identical to the way it was in previous versions if you'd like to look at the source. Nothing has changed since before the framework was released.

Releasing the full source code for the framework is a larger discussion that needs to be had internally, and I would not count on it being done anytime soon.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by mmilen »

That is sad to hear.
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: SFSBUddyManager crash after connection is close.

Post by A51Integrated »

As I mentioned above, the code for the Buddy Manager is identical to the older API and therefore you already have what you're asking for.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
Post Reply