Revision: 77436
http://sourceforge.net/p/brlcad/code/77436
Author: starseeker
Date: 2020-10-15 03:33:04 +0000 (Thu, 15 Oct 2020)
Log Message:
-----------
Closing multiple rt instances is crashing MGED on Windows. Really need to
defer I/O channel closure until all currently running subprocesses are
terminated... in the meantime try not to do things that cause the crash. This
isn't a final solution, because I/O from any remaining running subprocesses
will be lost as the first one calls the delete handlers and closes the channels.
Modified Paths:
--------------
brlcad/trunk/src/libtclcad/commands.c
Modified: brlcad/trunk/src/libtclcad/commands.c
===================================================================
--- brlcad/trunk/src/libtclcad/commands.c 2020-10-15 01:57:58 UTC (rev
77435)
+++ brlcad/trunk/src/libtclcad/commands.c 2020-10-15 03:33:04 UTC (rev
77436)
@@ -1224,16 +1224,22 @@
if (fdp) {
switch (d) {
case BU_PROCESS_STDIN:
- t_iod->chan_stdin = Tcl_MakeFileChannel(*fdp, t_iod->io_mode);
- Tcl_CreateChannelHandler(t_iod->chan_stdin, t_iod->io_mode,
callback, (ClientData)data);
+ if (!t_iod->chan_stdin) {
+ t_iod->chan_stdin = Tcl_MakeFileChannel(*fdp,
t_iod->io_mode);
+ Tcl_CreateChannelHandler(t_iod->chan_stdin,
t_iod->io_mode, callback, (ClientData)data);
+ }
break;
case BU_PROCESS_STDOUT:
- t_iod->chan_stdout = Tcl_MakeFileChannel(*fdp, t_iod->io_mode);
- Tcl_CreateChannelHandler(t_iod->chan_stdout, t_iod->io_mode,
callback, (ClientData)data);
+ if (!t_iod->chan_stdout) {
+ t_iod->chan_stdout = Tcl_MakeFileChannel(*fdp,
t_iod->io_mode);
+ Tcl_CreateChannelHandler(t_iod->chan_stdout,
t_iod->io_mode, callback, (ClientData)data);
+ }
break;
case BU_PROCESS_STDERR:
- t_iod->chan_stderr = Tcl_MakeFileChannel(*fdp, t_iod->io_mode);
- Tcl_CreateChannelHandler(t_iod->chan_stderr, t_iod->io_mode,
callback, (ClientData)data);
+ if (!t_iod->chan_stderr) {
+ t_iod->chan_stderr = Tcl_MakeFileChannel(*fdp,
t_iod->io_mode);
+ Tcl_CreateChannelHandler(t_iod->chan_stderr,
t_iod->io_mode, callback, (ClientData)data);
+ }
break;
}
}
@@ -1251,6 +1257,7 @@
if (t_iod->chan_stdin) {
Tcl_DeleteChannelHandler(t_iod->chan_stdin, NULL,
(ClientData)NULL);
Tcl_Close(t_iod->interp, t_iod->chan_stdin);
+ t_iod->chan_stdin = NULL;
}
break;
case BU_PROCESS_STDOUT:
@@ -1257,6 +1264,7 @@
if (t_iod->chan_stdout) {
Tcl_DeleteChannelHandler(t_iod->chan_stdout, NULL,
(ClientData)NULL);
Tcl_Close(t_iod->interp, t_iod->chan_stdout);
+ t_iod->chan_stdout = NULL;
}
break;
case BU_PROCESS_STDERR:
@@ -1263,6 +1271,7 @@
if (t_iod->chan_stderr) {
Tcl_DeleteChannelHandler(t_iod->chan_stderr, NULL,
(ClientData)NULL);
Tcl_Close(t_iod->interp, t_iod->chan_stderr);
+ t_iod->chan_stderr = NULL;
}
break;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits