Re[2]: Exit when a signal is recieved

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Tue, 16 Jul 2024 04:01:00 -0700 (PDT) Сергей Коныгин wrote:

> Maybe I said it wrong.  My question was exactly how to do the correct exit 
> using by wxWidgets. I decided to use the function 
> wxAppConsole::ExitMainLoop(). Everything works well: OnExit runs, global 
> destructors run.

 Using this function is the right thing to do, if your program is running
wxEventLoop, but calling it from a signal handler is almost certainly not
signal-safe (just read about the recent regreSSHion vulnerability in
OpenSSH to see what this can result in).

 You need to arrange things so that it's called from the event loop itself
when some flag is set from the signal handler.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZpZmGgAKCRAG6kHeT2we
hlXhAJ9VqTdPyhBVHKxvJ8E/U1zIbV1jOwCbBo+smuovmMuC6ZBjyPjrBgtm67M=
=I4Ze
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.