/* gcc `pkg-config --cflags --libs gtk+-3.0` test.c -g -O0 -o test && ./test */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>

static void
object_gone (gpointer user_data,
	     GObject *obj)
{
	printf ("%s: %s: %p\n", __FUNCTION__, (const gchar *) user_data, obj);
}

#define track(x) { printf ("Tracking %s: %p\n", #x, x); g_object_weak_ref (G_OBJECT (x), object_gone, #x); }

int main (int argc, char *argv[])
{
	GtkWidget *tree_view;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;

	gtk_init (&argc, &argv);

	tree_view = gtk_tree_view_new ();
	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes ("Name", renderer, "text", 0, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);

	track (tree_view);
	track (renderer);
	track (column);
	track (gtk_tree_view_column_get_button (column));

	gtk_widget_destroy (tree_view);

	return 0;
}
