1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-29 04:12:18 -05:00

Dispose of IRCConnections properly to avoid leaking IRCService objects

Each IRCConnection starts an input thread and an output thread when
created; if not stopped, these threads continue to hold the IRCService,
resulting in a leak when the service is stopped.  Fix this by using
PircBot's dispose() to stop the threads when disposing of the
IRCConnection.
This commit is contained in:
Steven Luo 2011-05-29 17:47:24 -07:00 committed by Sebastian Kaspari
parent ffe73b7c9f
commit ae1b574997

View File

@ -372,7 +372,14 @@ public class IRCService extends Service
for (int i = 0; i < mSize; i++) {
server = mServers.get(i);
if (server.isDisconnected()) {
connections.remove(server.getId());
int serverId = server.getId();
synchronized(this) {
IRCConnection connection = connections.get(serverId);
if (connection != null) {
connection.dispose();
}
connections.remove(serverId);
}
} else {
shutDown = false;
}