changeset 17755:9c03b071fd7b

avoid HDF5 error message at exit (bug #37713) * load-save.h, load-save.cc (octave_prepare_hdf5, octave_finalize_hdf5): New functions. * octave.cc (octave_execute_interpreter): Call octave_prepare_hdf5. * toplev.cc (do_octave_atexit): Call octave_finalize_hdf5.
author John W. Eaton <jwe@octave.org>
date Thu, 24 Oct 2013 17:13:02 -0400
parents dffb1e9a6d3b
children 9aff1c9fd70f
files libinterp/corefcn/load-save.cc libinterp/corefcn/load-save.h libinterp/corefcn/toplev.cc libinterp/octave.cc
diffstat 4 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-save.cc	Thu Oct 24 13:53:45 2013 -0700
+++ b/libinterp/corefcn/load-save.cc	Thu Oct 24 17:13:02 2013 -0400
@@ -1268,6 +1268,22 @@
     }
 }
 
+void
+octave_prepare_hdf5 (void)
+{
+#ifdef HAVE_HDF5
+  H5dont_atexit ();
+#endif
+}
+
+void
+octave_finalize_hdf5 (void)
+{
+#ifdef HAVE_HDF5
+  H5close ();
+#endif
+}
+
 static void
 save_vars (const string_vector& argv, int argv_idx, int argc,
            std::ostream& os, load_save_format fmt,
--- a/libinterp/corefcn/load-save.h	Thu Oct 24 13:53:45 2013 -0700
+++ b/libinterp/corefcn/load-save.h	Thu Oct 24 17:13:02 2013 -0400
@@ -92,4 +92,8 @@
 extern void
 write_header (std::ostream& os, load_save_format format);
 
+extern void octave_prepare_hdf5 (void);
+
+extern void octave_finalize_hdf5 (void);
+
 #endif
--- a/libinterp/corefcn/toplev.cc	Thu Oct 24 13:53:45 2013 -0700
+++ b/libinterp/corefcn/toplev.cc	Thu Oct 24 17:13:02 2013 -0400
@@ -57,6 +57,7 @@
 #include "graphics.h"
 #include "input.h"
 #include "lex.h"
+#include "load-save.h"
 #include "octave-link.h"
 #include "oct-conf.h"
 #include "oct-conf-features.h"
@@ -693,6 +694,8 @@
 
       OCTAVE_SAFE_CALL (sysdep_cleanup, ());
 
+      OCTAVE_SAFE_CALL (octave_finalize_hdf5, ());
+
       OCTAVE_SAFE_CALL (flush_octave_stdout, ());
 
       if (! quitting_gracefully && (interactive || forced_interactive))
--- a/libinterp/octave.cc	Thu Oct 24 13:53:45 2013 -0700
+++ b/libinterp/octave.cc	Thu Oct 24 17:13:02 2013 -0400
@@ -57,6 +57,7 @@
 #include "input.h"
 #include "lex.h"
 #include "load-path.h"
+#include "load-save.h"
 #include "octave.h"
 #include "oct-conf.h"
 #include "oct-hist.h"
@@ -958,6 +959,8 @@
   if (! inhibit_startup_message)
     std::cout << octave_startup_message () << "\n" << std::endl;
 
+  octave_prepare_hdf5 ();
+
   execute_startup_files ();
 
   if (! inhibit_startup_message && reading_startup_message_printed)