handle sigquit properly
ClosedPublic

Authored by sitter on Mar 21 2018, 11:10 AM.

Details

Summary

this prevents an excessive amount of coredumps being caused by pkcon
which sigquits the helper

Test Plan
debconf-kde-helper --socket-path=/tmp/gpk-26_baceaeca.socket
kill -QUIT `pidof debconf-kde-helper
  • no crash

Diff Detail

Repository
R547 DebConf-KDE Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sitter requested review of this revision.Mar 21 2018, 11:10 AM
sitter created this revision.
sitter edited the test plan for this revision. (Show Details)Mar 21 2018, 11:10 AM

AFAIK this is the wrong way of handling signals, don't recall exactly what the problem is, but Qt documentation says to create a pipe, attach a QSocketNotifier to it, and write data to it when the signal is caught, then the QSN signal will call qApp->quit();

Ah yes, signal safety. Bane of everyone's code readability.

sitter updated this revision to Diff 30130.Mar 21 2018, 2:24 PM

now signal-safe

  • handler writes to one end of anon socket
  • to the other is a QSocketNotifier attached
  • QSN activates when handler writes -> we read the dummy data and quit
dantti accepted this revision.Mar 21 2018, 2:28 PM

LGTM I only confused about why do you need QRegExp :P

This revision is now accepted and ready to land.Mar 21 2018, 2:28 PM

QRegExp is only a change to the new/flat include style. Doesn't actually have anything to do with the fix. It's used in the main().

This revision was automatically updated to reflect the committed changes.