/* gcc `pkg-config --cflags --libs glib-2.0 gio-2.0` gnm-crash.c -g -o gnm-crash && for i in {1..100}; do ./gnm-crash; done */

#include <glib.h>
#include <gio/gio.h>
#include <string.h>
#include <stdio.h>

static gboolean
quit_loop (gpointer user_data)
{
	g_main_loop_quit (user_data);

	return FALSE;
}

static gpointer
thread_func (gpointer user_data)
{
	g_network_monitor_get_default ();
	g_timeout_add (100, quit_loop, user_data);
	return NULL;
}

static gboolean
call_func (gpointer user_data)
{
	GThread *thread;

	thread = g_thread_new (NULL, thread_func, user_data);
	g_thread_unref (thread);

	return FALSE;
}

int
main (int argc, char **argv)
{
	GMainLoop *main_loop;

	main_loop = g_main_loop_new (NULL, FALSE);

	g_timeout_add (1, call_func, main_loop);

	g_main_loop_run (main_loop);

	g_main_loop_unref (main_loop);

	return 0;
}
