Opened 12 years ago
Closed 12 years ago
#10843 closed Bug Report - General (Fixed)
SignalHandler does not handle SIGTERM and SIGINT when there is no event loop.
Reported by: | danielk | Owned by: | beirdo |
---|---|---|---|
Priority: | minor | Milestone: | 0.26 |
Component: | MythTV - General | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
There are really two problems:
1/ A program like mythcomflag/mythtranscode/mythccextractor won't be running an event loop so the QSocketNotifier will never fire a handleSignal(). This could be addressed by calling QCoreApplication::processEvents() periodically. 2/ If you aren't running in a qApp->exec() then qApp->quit()/qApp->exit(int) doesn't do anything. This could be addressed by setting a static volatile bool when the program should exit and having the program check that after calling QCoreApplication::processEvents().
It might also make sense to set the signal handler to the default within SignalHandler::signalHandler(), then a second SIGKILL or a second SIGINT would kill the program a less elegantly. This would allow routines where forget to add the above to to exit. But we probably wouldn't want to do this right away as we want to identify the places where there is no proper program exit on a signal and not exiting is one way to do that.
Change History (3)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Owner: | changed from bierdo to beirdo |
---|---|
Status: | new → assigned |
comment:3 Changed 12 years ago by
Resolution: | → Fixed |
---|---|
Status: | assigned → closed |
I have also made the code change such that the UNIX handler will remove the handler and set to default on SIGTERM and SIGINT, so that if you are not in an event loop, double Ctrl-C should exit.
I believe this is complete.
In b0473717bdca14e8d4679cda31de17c87b86cd5f/mythtv: