From cba6f5f2984cfaa5361a12ac730b692dbcaf2b96 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 20 Apr 2016 17:28:53 +0200 Subject: [PATCH] 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 --- repos/base/src/base/console/log_console.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/repos/base/src/base/console/log_console.cc b/repos/base/src/base/console/log_console.cc index b4271a5b5a..7b1c87e56d 100644 --- a/repos/base/src/base/console/log_console.cc +++ b/repos/base/src/base/console/log_console.cc @@ -16,13 +16,10 @@ #include #include #include +#include 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(); } /**