Search code examples
c++gtkmm

Preventing GTKMM from catching exceptions


Is there a way to prevent 'Gtk::Main::iteration()' from catching exceptions?

Whenever there's an exception thrown inside a handler, it catches and then the program finishes with a SIGTRAP (in linux). With the message:

(test.debug.bin:32233): glibmm-ERROR **: 
unhandled exception (type std::exception) in signal handler:
what: test

Solution

  • No, sorry. That unhandled exception message is just a more useful alternative to a crash with no message, which is what you'd get if gtkmm didn't do this. You need to handle exceptions in your signal handlers in your own code.

    This is because your gtkmm signal handler is actually being called by GTK+ C code, compiled as C, and that can't pass a C++ exception through the C code back up to whatever C++ code might have called the C code.