--- /dev/null
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdio.h>
+
+int crash_other_thread = 0;
+#define CRASHING_THREAD 19
+
+gboolean crasher(gpointer data)
+{
+ *(int*)data = 1;
+ return TRUE;
+}
+
+void *fun(void *arg)
+{
+ int threadnum = (int)arg;
+ if (crash_other_thread && threadnum == CRASHING_THREAD)
+ crasher(NULL);
+ else
+ while (1);
+ return NULL;
+}
+
+int main(int argc)
+{
+ GMainLoop *loop = g_main_loop_new(NULL, FALSE);
+
+ crash_other_thread = argc > 1;
+
+ if (!crash_other_thread)
+ {
+ GSource *idle_source = g_idle_source_new();
+ g_source_set_callback(idle_source, crasher, NULL, NULL);
+ g_source_attach(idle_source, g_main_context_ref_thread_default());
+ }
+
+ pthread_t t;
+ int i;
+
+ for (i = 0; i <= CRASHING_THREAD; i++)
+ pthread_create(&t, NULL, fun, (void *)i);
+
+ g_main_loop_run(loop);
+
+ return 0;
+}