changeset 27175:613a31410ad0

backout changeset 196dfb42f3e9
author John W. Eaton <jwe@octave.org>
date Wed, 12 Jun 2019 10:12:31 -0500
parents b42350f18afb
children 0112951951a9
files libinterp/corefcn/procstream.cc libinterp/corefcn/procstream.h
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/procstream.cc	Wed Jun 12 09:43:41 2019 -0500
+++ b/libinterp/corefcn/procstream.cc	Wed Jun 12 10:12:31 2019 -0500
@@ -30,12 +30,16 @@
 
 procstreambase::procstreambase (const std::string& command, int mode)
 {
+  pb_init ();
+
   if (! m_pb.open (command.c_str (), mode))
     std::ios::setstate (std::ios::badbit);
 }
 
 procstreambase::procstreambase (const char *command, int mode)
 {
+  pb_init ();
+
   if (! m_pb.open (command, mode))
     std::ios::setstate (std::ios::badbit);
 }
--- a/libinterp/corefcn/procstream.h	Wed Jun 12 09:43:41 2019 -0500
+++ b/libinterp/corefcn/procstream.h	Wed Jun 12 10:12:31 2019 -0500
@@ -38,7 +38,7 @@
 {
 public:
 
-  procstreambase (void) : m_pb () { }
+  procstreambase (void) : m_pb () { pb_init (); }
 
   procstreambase (const std::string& name, int mode);
 
@@ -65,6 +65,13 @@
 
   octave_procbuf m_pb;
 
+  void pb_init (void)
+  {
+    // Explicit initialization of the std::ios object is needed.
+    // FIXME: is there a better way to organize these classes?
+    init (&pb);
+  }
+
   procstreambase (const procstreambase&);
 
   procstreambase& operator = (const procstreambase&);
@@ -73,7 +80,6 @@
 class
 OCTINTERP_API
 iprocstream : public std::istream, public procstreambase
-// iprocstream : public procstreambase, public std::istream
 {
 public: