Skip to content

vtkFloatingPointExceptions: replace dangerous comment

Throwing from a signal handler is UB in a variety of ways, so don't suggest it. Just a few reasons in case this comes up in some poor soul's search for the history of this handler:

  • VTK is not exception safe to begin with, so abort() is far safer
  • Even if it was exception-aware, there's no guarantee that the handler isn't triggered from some noexcept function
  • Even if we knew no noexcept function called it, it may be triggered inside of Python code or the OpenGL stack

Of course, this handler is already on shaky ground because fprintf is not a signal-hander-safe function call, but since we're destined for an abort(), it's not like we're hoping that any damage caused is recoverable anyways. So at least update the comment to avoid problems for "helpful" contributors that see this as a TODO item.

Merge request reports