changeset 2564:2ccc43202018

Another attempt at fixing the occasional problem with X errors when the synthetic target I/O auxiliary exits.
author bartv
date Tue, 07 Oct 2008 09:47:39 +0000
parents 73921684f287
children f9d071633ee7
files packages/hal/synth/arch/current/ChangeLog packages/hal/synth/arch/current/host/ecosynth.tcl
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/synth/arch/current/ChangeLog
+++ b/packages/hal/synth/arch/current/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-07  Bart Veer  <bartv@ecoscentric.com>
+
+	* host/ecosynth.tcl: another attempt to fix the X problems when
+	shutting down.
+
 2008-08-28  Bart Veer  <bartv@ecoscentric.com>
 
 	* host/configure: regenerate after update of Tcl macro
--- a/packages/hal/synth/arch/current/host/ecosynth.tcl
+++ b/packages/hal/synth/arch/current/host/ecosynth.tcl
@@ -327,6 +327,12 @@ proc exit { { code 0 } } {
         # about them anyway.
         catch { eval $handler [list]}
     }
+    # When running in GUI mode, some versions of Tk on top of some versions
+    # of X have problems shutting down cleanly and may report an X error.
+    # It is not understood exactly what is going on. This close causes the
+    # error to be ignored silently. Since we are exiting anyway, that is
+    # good enough.
+    close stderr
     _hook_real_exit $code
 }
 
@@ -1322,8 +1328,7 @@ namespace eval synth {
     
     proc _handle_exit_request { } {
         if { !$synth::ecos_running } {
-            after idle destroy .
-            return
+            exit 0
         }
         # Setting this flag causes ecosynth to exit immediately once
         # the application terminates.
@@ -3099,11 +3104,7 @@ namespace eval synth {
         # Depending on command-line arguments and whether or not the GUI is present,
         # the auxiliary should now exit
         if { $synth::flag_immediate_exit } {
-            if { $synth::flag_gui } {
-                after idle destroy .
-            } else {
-                exit 0
-            }
+            exit 0
         } elseif { !$synth::flag_gui } {
             synth::report "eCos application has exited: I/O auxiliary still running in the background.\n"
         }