Revision: 77110
          http://sourceforge.net/p/brlcad/code/77110
Author:   starseeker
Date:     2020-09-12 16:36:25 +0000 (Sat, 12 Sep 2020)
Log Message:
-----------
Cherrypick r77109 - null check before Tcl_Close

Modified Paths:
--------------
    brlcad/branches/RELEASE/src/libtclcad/commands.c

Property Changed:
----------------
    brlcad/branches/RELEASE/

Index: brlcad/branches/RELEASE
===================================================================
--- brlcad/branches/RELEASE     2020-09-12 16:34:57 UTC (rev 77109)
+++ brlcad/branches/RELEASE     2020-09-12 16:36:25 UTC (rev 77110)

Property changes on: brlcad/branches/RELEASE
___________________________________________________________________
Modified: svn:mergeinfo
## -7,4 +7,4 ##
 /brlcad/branches/opencl:65867-66137
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
-/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-75207,75325,75375,75377-75378,75387,75470-75472,75477,75492,75495,75549,75565-75566,75656-75661,75672,75675,75678,75729,75811,76641-76768,76771-76967,76975-76991,76994-77096,77105
\ No newline at end of property
+/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-75207,75325,75375,75377-75378,75387,75470-75472,75477,75492,75495,75549,75565-75566,75656-75661,75672,75675,75678,75729,75811,76641-76768,76771-76967,76975-76991,76994-77096,77105,77109
\ No newline at end of property
Modified: brlcad/branches/RELEASE/src/libtclcad/commands.c
===================================================================
--- brlcad/branches/RELEASE/src/libtclcad/commands.c    2020-09-12 16:34:57 UTC 
(rev 77109)
+++ brlcad/branches/RELEASE/src/libtclcad/commands.c    2020-09-12 16:36:25 UTC 
(rev 77110)
@@ -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

Reply via email to