Page 1 of 2
SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 03:13
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 15:44
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 16:33
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 16:34
by mmilen
Legally I can share the project code. Can you legally share the API source code?
I
Re: SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 16:37
by mmilen
Legally i can't share the project code.
Re: SFSBUddyManager crash after connection is close.
Posted: 18 Jun 2012, 17:43
by A51Integrated
How are you initializing the buddy list?
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 01:58
by mmilen
onLogin event, after successful login i do : [self.client send:[InitBuddyListRequest request]];
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 02:06
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?
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 02:21
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 02:53
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 03:10
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 03:20
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 10:49
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.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 12:09
by mmilen
That is sad to hear.
Re: SFSBUddyManager crash after connection is close.
Posted: 19 Jun 2012, 12:38
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.