os/reporter.h: Don't enable if connection fails

If opening a report session fails (for example because of invalid
session arguments) and an exception is thrown during the session
construction, the report would wrongly keep the enabled state.
By moving the assignment of the state after the construction,
the report stays disabled as it should be.
This commit is contained in:
Norman Feske 2014-02-14 20:39:15 +01:00 committed by Christian Helmuth
parent 57fdce0465
commit 4c45f3451c

View File

@ -52,12 +52,12 @@ class Genode::Reporter : Noncopyable
{ {
if (enabled == _enabled) return; if (enabled == _enabled) return;
_enabled = enabled; if (enabled)
if (_enabled)
_conn.construct(_name.string()); _conn.construct(_name.string());
else else
_conn.destruct(); _conn.destruct();
_enabled = enabled;
} }
bool is_enabled() const { return _enabled; } bool is_enabled() const { return _enabled; }