diff -r 5fbbda78c175 -r 783d835d7fe4 src/eric7/Debugger/DebuggerInterfacePython.py --- a/src/eric7/Debugger/DebuggerInterfacePython.py Mon Jan 01 11:11:21 2024 +0100 +++ b/src/eric7/Debugger/DebuggerInterfacePython.py Wed Jan 31 09:13:13 2024 +0100 @@ -664,7 +664,7 @@ @param sock reference to the disconnected socket @type QTcpSocket """ - for debuggerId in self.__connections: + for debuggerId in list(self.__connections): if self.__connections[debuggerId] is sock: del self.__connections[debuggerId] if debuggerId == self.__mainDebugger: @@ -705,10 +705,9 @@ """ if self.__mainDebugger: # Send commands that were waiting for the connection. + conn = self.__connections[self.__mainDebugger] for cmd in self.queue: - self.__writeJsonCommandToSocket( - cmd, self.__connections[self.__mainDebugger] - ) + self.__writeJsonCommandToSocket(cmd, conn) self.queue = []