logger outbuf not initialized when ostream ctor is called
A crash happens on the static initialization of eoLogger eo::log; at the end of the file eoLogger.cpp (line 255) The reason is that the ctor used to initialize the std::eostream base class of eoLogger is invoked with an _obuf argument while _obuf has not been initialized already. The solution is to call the function std::ostream::init(&_obuf) after the ctor initalizer list, i.e. inside the body ctor.
This commit is contained in:
parent
6ae4d1e7e5
commit
d706968c31
1 changed files with 4 additions and 2 deletions
|
|
@ -58,7 +58,7 @@ void eoLogger::_init()
|
|||
}
|
||||
|
||||
eoLogger::eoLogger() :
|
||||
std::ostream(&_obuf),
|
||||
std::ostream(NULL),
|
||||
|
||||
_verbose("quiet", "verbose", "Set the verbose level", 'v'),
|
||||
_printVerboseLevels(false, "print-verbose-levels", "Print verbose levels", 'l'),
|
||||
|
|
@ -69,11 +69,12 @@ eoLogger::eoLogger() :
|
|||
_fd(2),
|
||||
_obuf(_fd, _contextLevel, _selectedLevel)
|
||||
{
|
||||
std::ostream::init(&_obuf);
|
||||
_init();
|
||||
}
|
||||
|
||||
eoLogger::eoLogger(eo::file file) :
|
||||
std::ostream(&_obuf),
|
||||
std::ostream(NULL),
|
||||
|
||||
_verbose("quiet", "verbose", "Set the verbose level", 'v'),
|
||||
_printVerboseLevels(false, "print-verbose-levels", "Print verbose levels", 'l'),
|
||||
|
|
@ -84,6 +85,7 @@ eoLogger::eoLogger(eo::file file) :
|
|||
_fd(2),
|
||||
_obuf(_fd, _contextLevel, _selectedLevel)
|
||||
{
|
||||
std::ostream::init(&_obuf);
|
||||
_init();
|
||||
*this << file;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue