# HG changeset patch # User John W. Eaton # Date 1382649182 14400 # Node ID 9c03b071fd7bd6f47b369ee6fcd0afdf43ebfc8f # Parent dffb1e9a6d3b0f3d994c4232bb064d1b0796ccb5 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. diff -r dffb1e9a6d3b -r 9c03b071fd7b libinterp/corefcn/load-save.cc --- 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, diff -r dffb1e9a6d3b -r 9c03b071fd7b libinterp/corefcn/load-save.h --- 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 diff -r dffb1e9a6d3b -r 9c03b071fd7b libinterp/corefcn/toplev.cc --- 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)) diff -r dffb1e9a6d3b -r 9c03b071fd7b libinterp/octave.cc --- 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)