[Geany-devel] Signal Handling

Lex Trotman elextr at xxxxx
Mon Sep 10 00:23:52 UTC 2012


Hi All,

As pointed out here
https://sourceforge.net/tracker/?func=detail&aid=3440227&group_id=153444&atid=787791
the current signal handling in Geany is broken.

Matthew tried my suggestion of g_unix_signal() but as Colomban noted
on IRC its a fairly new function (glib 2.30).  There was no resolution
of this after their tl;dr discussion on IRC.

I suggest that:

1. The current signal handling be removed, it is broken and
potentially extremely dangerous.  Simply letting the application exit
is safer.

2. g_signal_unix() be used when available, but the runtime
glib_check_version() must be used instead of the compile time
GLIB_CHECK_VERSION() since it is the target glib that matters, not the
build system one.  This of course requires lazy dynamic linking so
that it won't get a missing symbol error if g_signal_unix is not
available, but luckily its the default on most Linuxii.

3. Matthew has suggested adding SIGINT to the handling.  That raises
the question of why is this handling here anyway?

SIGTERM is used by window managers to signal imminent logout/shutdown.
 So there is no time for GUI checks to happen, and refusing to
shutdown is going to be ignored anyway.  For example, on my system if
Geany is running on shutdown, a warning from the WM flashes past and
goes away as the process is SIGKILLed for not dying quickly enough.

So can anyone describe a useful use-case for catching SIGTERM and
potentially refusing to exit?  And also for SIGINT.

Cheers
Lex



More information about the Devel mailing list