mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-25 18:32:15 -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:
parent
ffe73b7c9f
commit
ae1b574997
@ -372,7 +372,14 @@ public class IRCService extends Service
|
|||||||
for (int i = 0; i < mSize; i++) {
|
for (int i = 0; i < mSize; i++) {
|
||||||
server = mServers.get(i);
|
server = mServers.get(i);
|
||||||
if (server.isDisconnected()) {
|
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 {
|
} else {
|
||||||
shutDown = false;
|
shutDown = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user