mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Clear channel attributes on channel unregister to avoid project leaks (IDEA-158108)
This commit is contained in:
@@ -71,7 +71,14 @@ class BuildMessageDispatcher extends SimpleChannelInboundHandlerAdapter<CmdlineR
|
||||
public BuilderMessageHandler unregisterBuildMessageHandler(UUID sessionId) {
|
||||
myCanceledSessions.remove(sessionId);
|
||||
final SessionData data = mySessionDescriptors.remove(sessionId);
|
||||
return data != null? data.handler : null;
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
final Channel channel = data.channel;
|
||||
if (channel != null) {
|
||||
channel.attr(SESSION_DATA).remove(); // cleanup the attribute so that session data is not leaked
|
||||
}
|
||||
return data.handler;
|
||||
}
|
||||
|
||||
public void cancelSession(UUID sessionId) {
|
||||
|
||||
@@ -326,7 +326,7 @@ public class ExternalJavacManager {
|
||||
private class CompilationRequestsHandler extends SimpleChannelInboundHandler<JavacRemoteProto.Message> {
|
||||
@Override
|
||||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
|
||||
JavacProcessDescriptor descriptor = ctx.channel().attr(SESSION_DESCRIPTOR).get();
|
||||
JavacProcessDescriptor descriptor = ctx.channel().attr(SESSION_DESCRIPTOR).getAndRemove();
|
||||
if (descriptor != null) {
|
||||
descriptor.setDone();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user