base: no exit handler for libc stdout log console

We don't want Genode environment objects that register their destructor
for program exit as it is mostly unnecessary and easily produces
dangling pointers. Thus, use unmanaged_singleton instead of the static
keyword.

Fixes #1941
This commit is contained in:
Martin Stein 2016-04-20 17:28:53 +02:00 committed by Christian Helmuth
parent bf5df7d88d
commit cba6f5f298

View File

@ -16,13 +16,10 @@
#include <base/console.h>
#include <base/lock.h>
#include <base/env.h>
#include <base/internal/unmanaged_singleton.h>
using namespace Genode;
void *operator new (size_t, void *ptr) { return ptr; }
class Log_console : public Console
{
private:
@ -104,18 +101,7 @@ class Log_console : public Console
* use the 'Log_console' as backend.
*/
Log_console *stdout_log_console()
{
/*
* Construct the log console object on the first call of this function.
* In constrast to having a static variable in the global scope, the
* constructor gets only called when needed and no static constructor
* gets invoked by the initialization code.
*/
static Log_console static_log_console;
return &static_log_console;
}
static Log_console *stdout_log_console() { return unmanaged_singleton<Log_console>(); }
/**