This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

another synthetic target fix

My previous attempt (2008-08-13) at fixing the occasional X error
problems when the synthetic target I/O auxiliary exits was broken.
Although the graphical display was destroyed the auxiliary itself
could keep running in the background, so you ended up with lots of
auxiliary processes. This patch reverts to the original exit code, but
adds a workaround.

Exactly why the Tk shutdown process causes an X error on some
installations (currently I am using Fedora 9) is unknown, and I have
had little luck tracking down the problem. It happens deep down
between libtk and X11. Instead I cheat and close the stderr channel
just before the real exit is initiated. The X error will still occur
but will have nowhere to output its error message, so the failure has
become silent. It is possible that some other bits of atexit handling
no longer run, but nothing that should affect the synthetic target.


2008-10-07  Bart Veer  <>

	* host/ecosynth.tcl: another attempt to fix the X problems when
	shutting down.

Index: host/ecosynth.tcl
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/host/ecosynth.tcl,v
retrieving revision 1.2
diff -u -p -r1.2 ecosynth.tcl
--- host/ecosynth.tcl	13 Aug 2008 21:08:54 -0000	1.2
+++ host/ecosynth.tcl	7 Oct 2008 09:32:48 -0000
@@ -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"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]