diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 20:48:51 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 20:48:51 +0100 |
commit | c720818cb538c7b31fd918bfd5e69db6428b4645 (patch) | |
tree | 25099cb4e891a86cce82f3fa9ce2df72e26bee52 /glib/glibmm/exceptionhandler.cc | |
parent | b2157a47efd33144c65cb46902c89dafba7acfcb (diff) | |
download | glibmm-c720818cb538c7b31fd918bfd5e69db6428b4645.tar.gz |
Run clang-format on glib .cc files.
Diffstat (limited to 'glib/glibmm/exceptionhandler.cc')
-rw-r--r-- | glib/glibmm/exceptionhandler.cc | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc index faad2a06..c12e199a 100644 --- a/glib/glibmm/exceptionhandler.cc +++ b/glib/glibmm/exceptionhandler.cc @@ -26,7 +26,6 @@ #include <exception> #include <list> - namespace { @@ -36,27 +35,27 @@ typedef sigc::signal<void> HandlerList; // to avoid thread synchronization problems. static thread_local HandlerList* thread_specific_handler_list = nullptr; - -static void glibmm_exception_warning(const GError* error) +static void +glibmm_exception_warning(const GError* error) { g_assert(error != nullptr); g_critical("\n" - "unhandled exception (type Glib::Error) in signal handler:\n" - "domain: %s\n" - "code : %d\n" - "what : %s\n", - g_quark_to_string(error->domain), error->code, - (error->message) ? error->message : "(null)"); + "unhandled exception (type Glib::Error) in signal handler:\n" + "domain: %s\n" + "code : %d\n" + "what : %s\n", + g_quark_to_string(error->domain), error->code, (error->message) ? error->message : "(null)"); } -static void glibmm_unexpected_exception() +static void +glibmm_unexpected_exception() { try { throw; // re-throw current exception } - catch(const Glib::Error& error) + catch (const Glib::Error& error) { // Access the GError directly, to avoid possible exceptions from C++ code. glibmm_exception_warning(error.gobj()); @@ -65,13 +64,14 @@ static void glibmm_unexpected_exception() // program seems too harsh. Instead, give control back to the main loop. return; } - catch(const std::exception& except) + catch (const std::exception& except) { g_error("\n" - "unhandled exception (type std::exception) in signal handler:\n" - "what: %s\n", except.what()); + "unhandled exception (type std::exception) in signal handler:\n" + "what: %s\n", + except.what()); } - catch(...) + catch (...) { g_error("\nunhandled exception (type unknown) in signal handler\n"); } @@ -79,15 +79,15 @@ static void glibmm_unexpected_exception() } // anonymous namespace - namespace Glib { -sigc::connection add_exception_handler(const sigc::slot<void>& slot) +sigc::connection +add_exception_handler(const sigc::slot<void>& slot) { HandlerList* handler_list = thread_specific_handler_list; - if(!handler_list) + if (!handler_list) { handler_list = new HandlerList(); thread_specific_handler_list = handler_list; @@ -98,7 +98,8 @@ sigc::connection add_exception_handler(const sigc::slot<void>& slot) } // internal -void exception_handlers_invoke() noexcept +void +exception_handlers_invoke() noexcept { // This function will be called from our GLib signal handler proxies // if an exception has been caught. It's not possible to throw C++ @@ -113,15 +114,15 @@ void exception_handlers_invoke() noexcept // handled. If there are no more handlers in the list and the exception // is still unhandled, call glibmm_unexpected_exception(). - if(HandlerList *const handler_list = thread_specific_handler_list) + if (HandlerList* const handler_list = thread_specific_handler_list) { HandlerList::iterator pslot = handler_list->slots().begin(); - while(pslot != handler_list->slots().end()) + while (pslot != handler_list->slots().end()) { // Calling an empty slot would mean ignoring the exception, // thus we have to check for dead slots explicitly. - if(pslot->empty()) + if (pslot->empty()) { pslot = handler_list->slots().erase(pslot); continue; @@ -133,7 +134,7 @@ void exception_handlers_invoke() noexcept { (*pslot)(); } - catch(...) // unhandled, try next slot + catch (...) // unhandled, try next slot { ++pslot; continue; @@ -150,6 +151,3 @@ void exception_handlers_invoke() noexcept } } // namespace Glib - - - |