Kaydet (Commit) 88957d8d authored tarafından Kurt B. Kaiser's avatar Kurt B. Kaiser

Fix race exposed by 2.4 GHz XP box: Don't tear down PyShell until

subprocess polling has terminated.  Tk callit gets unhappy if it can't
find the function 'after' scheduled to run.

M PyShell.py
üst 8fd86cc4
...@@ -426,8 +426,6 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -426,8 +426,6 @@ class ModifiedInterpreter(InteractiveInterpreter):
except (EOFError, IOError, KeyboardInterrupt): except (EOFError, IOError, KeyboardInterrupt):
# lost connection or subprocess terminated itself, restart # lost connection or subprocess terminated itself, restart
# [the KBI is from rpc.SocketIO.handle_EOF()] # [the KBI is from rpc.SocketIO.handle_EOF()]
if self.tkconsole.closing:
return
response = None response = None
self.restart_subprocess() self.restart_subprocess()
self.tkconsole.endexecuting() self.tkconsole.endexecuting()
...@@ -448,8 +446,10 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -448,8 +446,10 @@ class ModifiedInterpreter(InteractiveInterpreter):
print >>console, errmsg, what print >>console, errmsg, what
# we received a response to the currently active seq number: # we received a response to the currently active seq number:
self.tkconsole.endexecuting() self.tkconsole.endexecuting()
# Reschedule myself in 50 ms # Reschedule myself
self.tkconsole.text.after(50, self.poll_subprocess) if not self.tkconsole.closing:
self.tkconsole.text.after(self.tkconsole.pollinterval,
self.poll_subprocess)
debugger = None debugger = None
...@@ -716,6 +716,7 @@ class PyShell(OutputWindow): ...@@ -716,6 +716,7 @@ class PyShell(OutputWindow):
# #
self.history = self.History(self.text) self.history = self.History(self.text)
# #
self.pollinterval = 50 # millisec
if use_subprocess: if use_subprocess:
self.interp.start_subprocess() self.interp.start_subprocess()
...@@ -798,7 +799,12 @@ class PyShell(OutputWindow): ...@@ -798,7 +799,12 @@ class PyShell(OutputWindow):
self.interp.interrupt_subprocess() self.interp.interrupt_subprocess()
return "cancel" return "cancel"
else: else:
return EditorWindow.close(self) self.closing = True
# Wait for poll_subprocess() rescheduling to stop
self.text.after(2 * self.pollinterval, self.close2)
def close2(self):
return EditorWindow.close(self)
def _close(self): def _close(self):
"Extend EditorWindow._close(), shut down debugger and execution server" "Extend EditorWindow._close(), shut down debugger and execution server"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment