Revision: 77109
http://sourceforge.net/p/brlcad/code/77109
Author: starseeker
Date: 2020-09-12 16:34:57 +0000 (Sat, 12 Sep 2020)
Log Message:
-----------
Check for null before calling Tcl_Close
Modified Paths:
--------------
brlcad/trunk/src/libtclcad/commands.c
Modified: brlcad/trunk/src/libtclcad/commands.c
===================================================================
--- brlcad/trunk/src/libtclcad/commands.c 2020-09-12 03:35:44 UTC (rev
77108)
+++ brlcad/trunk/src/libtclcad/commands.c 2020-09-12 16:34:57 UTC (rev
77109)
@@ -1211,24 +1211,24 @@
tclcad_create_io_handler(struct ged_subprocess *p, bu_process_io_t d,
ged_io_func_t callback, void *data)
{
if (!p || !p->p || !p->gedp || !p->gedp->ged_io_data)
- return;
+ return;
struct tclcad_io_data *t_iod = (struct tclcad_io_data
*)p->gedp->ged_io_data;
HANDLE *fdp = (HANDLE *)bu_process_fd(p->p, d);
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);
- 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);
- 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);
- break;
- }
+ 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);
+ 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);
+ 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);
+ break;
+ }
}
}
@@ -1242,15 +1242,18 @@
switch (d) {
case BU_PROCESS_STDIN:
Tcl_DeleteChannelHandler(t_iod->chan_stdin, NULL,
(ClientData)NULL);
- Tcl_Close(t_iod->interp, t_iod->chan_stdin);
+ if (t_iod->chan_stdin)
+ Tcl_Close(t_iod->interp, t_iod->chan_stdin);
break;
case BU_PROCESS_STDOUT:
Tcl_DeleteChannelHandler(t_iod->chan_stdout, NULL,
(ClientData)NULL);
- Tcl_Close(t_iod->interp, t_iod->chan_stdout);
+ if (t_iod->chan_stdout)
+ Tcl_Close(t_iod->interp, t_iod->chan_stdout);
break;
case BU_PROCESS_STDERR:
Tcl_DeleteChannelHandler(t_iod->chan_stderr, NULL,
(ClientData)NULL);
- Tcl_Close(t_iod->interp, t_iod->chan_stderr);
+ if (t_iod->chan_stderr)
+ Tcl_Close(t_iod->interp, t_iod->chan_stderr);
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