TReKiE / msnp-sharp

Automatically exported from code.google.com/p/msnp-sharp
0 stars 0 forks source link

MSNPSharp.Messenger.CleanUp() doesn't actually clean up [conversation switchboards, SLP handlers, P2P sessions]. #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
MSNPSharp revision 19.

The MSNPSharp.Messenger class does not correctly clean up its conversation 
objects (or its slps/p2p sessions) on Messenger.Disconnect. The problem 
can be traced to the code at Messenger.CleanUp (indirectly called from 
Messenger.Disconnect). The code comment says that the method is supposed 
to "Clean up resources".

The bug is: CleanUp() does not actually do this.

To reproduce: call CleanUp() or Disconnect() while there are still active 
conversations. (Using the example program, you can do this by Signing In, 
chatting to a user, keeping the conversation window open, then clicking 
Sign Off).

What should happen is: Messenger.CleanUp() should close all existing 
conversations (for each conversation in conversations, Invoke 
conversation.switcboard.close), close all SLP handlers (for each slp in 
msnslps, invoke slp.dispose), and clear message sessions from the 
p2pHandler (this it does).

Messenger.CleanUp does call ArrayList.Clear, but ArrayList.Clear alone 
does not clean up the underlying resources (switchboard connections etc). 
That has to be done manually (or when the GC runs :-O ).

The result is: the conversation window is still active, and you can still 
chat with it (even though WLM says the user has gone offline).

What should happen is that all conversation windows are closed when you 
sign off (with all sockets being disconnected after that).

I've attached an updated Messenger.cs. CleanUp has been changed to call 
Conversation.Close for all conversations. Whilst I was at it, I also 
changed the collection to use Generics (seeing how you're heading in that 
direction).

Original issue reported on code.google.com by oshaho...@gmail.com on 11 Jun 2007 at 12:52

Attachments:

GoogleCodeExporter commented 9 years ago
The patch was applied to my tree, will be on the repository soon! 

Thanks!

Original comment by thiago.s...@gmail.com on 2 Jul 2007 at 11:38

GoogleCodeExporter commented 9 years ago

Original comment by hepha...@gmail.com on 23 Jan 2009 at 5:38