This question may belong to Unix/Linux in general, but I guess the answer is dependent on distro or desktop environment [I use KDE and Xfce so I would like an answer that is applicable on booth].
Consider this simple GTK app:
#include <gtk/gtk.h>
static void print_hello(GtkWidget *widget, gpointer data)
{
g_print ("Hello World\n");
// Intentional crash
int* badfood=NULL;
*badfood=1;
}
int main(int argc,char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);
GtkWidget* button = gtk_button_new_with_label ("Crash this app");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
gtk_main ();
return 0;
}
The program will crash with SIGSEGV when the user clicks "Crash this app". If run from the terminal, I get a notice:
$ ~/Skrivbord/gtktest/test
Hello World
Segmenteringsfel (minnesutskrift skapad)
And I am happy, but starting it through the launch box...
The window only disappears without any visible notice about a program crash. In the latter case, I want a message appear telling me something like
~/Skrivbord/gtktest/test
has caused a segmentation fault
much like I get in Windows.
By reading
man 5 core
I have found what happens when a program crash. By settingcore_pattern
, I can launch something else thanapport
thatfork
-setuid
-setgit
-exec
zenity
.