From 43cb637c97fa220d38e95673a129e3edf39244eb Mon Sep 17 00:00:00 2001 From: AntoinePrv Date: Thu, 2 Feb 2023 10:08:04 +0100 Subject: [PATCH] A fix for leaking control comm --- src/xtarget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xtarget.cpp b/src/xtarget.cpp index 6bd7a27..75b5d9a 100644 --- a/src/xtarget.cpp +++ b/src/xtarget.cpp @@ -181,9 +181,11 @@ namespace xw ); registered_comm.on_close( - [](const ::xeus::xmessage&) + [&](const ::xeus::xmessage&) { - // TODO need to remove from registry otherwise it is leaking + // This is not trivial. The comm is destructed from within one of its method. + // This works because no other instruction are executed by Xeus afterwards. + comm_registry.erase(registered_comm.id()); } ); }