[Idle-dev] CVS: idle PyShell.py,1.67,1.68

Kurt B. Kaiser kbk@users.sourceforge.net
Mon, 19 May 2003 16:11:53 -0700


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv6331

Modified Files:
	PyShell.py 
Log Message:
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


Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -r1.67 -r1.68
*** PyShell.py	15 May 2003 23:23:20 -0000	1.67
--- PyShell.py	19 May 2003 23:11:51 -0000	1.68
***************
*** 427,432 ****
              # lost connection or subprocess terminated itself, restart
              # [the KBI is from rpc.SocketIO.handle_EOF()]
-             if self.tkconsole.closing:
-                 return
              response = None
              self.restart_subprocess()
--- 427,430 ----
***************
*** 449,454 ****
              # we received a response to the currently active seq number:
              self.tkconsole.endexecuting()
!         # Reschedule myself in 50 ms
!         self.tkconsole.text.after(50, self.poll_subprocess)
  
      debugger = None
--- 447,454 ----
              # we received a response to the currently active seq number:
              self.tkconsole.endexecuting()
!         # Reschedule myself
!         if not self.tkconsole.closing:
!             self.tkconsole.text.after(self.tkconsole.pollinterval,
!                                       self.poll_subprocess)
  
      debugger = None
***************
*** 717,720 ****
--- 717,721 ----
          self.history = self.History(self.text)
          #
+         self.pollinterval = 50  # millisec
          if use_subprocess:
              self.interp.start_subprocess()
***************
*** 799,803 ****
              return "cancel"
          else:
!             return EditorWindow.close(self)
  
      def _close(self):
--- 800,809 ----
              return "cancel"
          else:
!             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):