view src/stable-octave-1-xerror.patch @ 3578:583d3bf548e6

texinfo: update to 5.2 and install all tools * src/texinfo.mk: update to 5.2 and make/make install all. * src/texinfo-1-fixes.patch: updated patch for 5.2.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 15 Apr 2014 21:32:17 -0400
parents 9735384a34fb
children
line wrap: on
line source

# HG changeset patch
# User John W. Eaton <jwe@octave.org>
# Date 1395159558 14400
#      Tue Mar 18 12:19:18 2014 -0400
# Branch stable
# Node ID 90dbbafb0502e80f5855239bc18eacdab5d85a29
# Parent  c08776badd3d7d59b8c918a09710dfc1f18add3d
prevent X11 errors from appearing in GUI command window

* octave-gui.cc (fdstderr): New file scope variable.
(octave_start_gui): Dup stderr.
(message_handler): Use fdstderr for messages.

diff --git a/libgui/src/octave-gui.cc b/libgui/src/octave-gui.cc
--- a/libgui/src/octave-gui.cc
+++ b/libgui/src/octave-gui.cc
@@ -85,28 +85,37 @@
   int m_result;
 };
 
+#if ! defined (__WIN32__) || defined (__CYGWIN__)
+static int fdstderr = -1;
+#endif
 
 // Custom message handler for filtering some messages from Qt.
 
-void message_handler (QtMsgType type, const char *msg)
+void
+message_handler (QtMsgType type, const char *msg)
 {
+#if ! defined (__WIN32__) || defined (__CYGWIN__)
+  static FILE *errstream = fdopen (fdstderr, "a+");
+#else
+  static FILE *errstream = stderr;
+#endif
+
   switch (type)
     {
     case QtDebugMsg:
-      if (strncmp (msg, "QFileSystemWatcher: skipping native engine",42) != 0)
-        std::cerr << "Debug: " << msg << std::endl;
+      gnulib::fprintf (errstream, "Debug: %s\n", msg);
       break;
 
     case QtWarningMsg:
-      std::cerr << "Warning: " << msg << std::endl;
+      gnulib::fprintf (errstream, "Warning: %s\n", msg);
       break;
 
     case QtCriticalMsg:
-      std::cerr << "Critical: " << msg << std::endl;
+      gnulib::fprintf (errstream, "Critical: %s\n", msg);
       break;
 
     case QtFatalMsg:
-      std::cerr << "Fatal: " << msg << std::endl;
+      gnulib::fprintf (errstream, "Fatal: %s\n", msg);
       abort ();
 
     default:
@@ -122,6 +131,13 @@
 {
   octave_thread_manager::block_interrupt_signal ();
 
+#if ! defined (__WIN32__) || defined (__CYGWIN__)
+  // Store the file descriptor associated with the STDERR stream.  Send
+  // Qt messages there instead of to the STDERR stream that will be
+  // associated with the GUI command window.
+  fdstderr = gnulib::dup (STDERR_FILENO);
+#endif
+
   qInstallMsgHandler (message_handler);
 
   if (start_gui)