Re: Re[2]: Exit when a signal is recieved
Сергей Коныгин <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Do I need to write my own MainLoop? I wouldn't like this. In my case the
solution could be to use wxIdleEvent to call ExitMainLoop().
void OnSignal( int sig )
{
GetMyApp()->mbSignal = true;
}
void MyApp::OnIdle( wxIdleEvent& event )
{
if( mbSignal ) ExitMainLoop();
}
вторник, 16 июля 2024 г. в 16:22:57 UTC+4, Vadim Zeitlin:
> 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/
>
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/18b4bb2d-6ef0-4d52-a21c-fabe090c416en%40googlegroups.com.