From 8c4653c4f2186d6c841d87db1f129455ab0374e8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 27 May 2011 04:20:45 +0200 Subject: [PATCH] tests: Make forcing of class registers work without gcc warnings --- tests/testtreeview.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/testtreeview.c b/tests/testtreeview.c index 80efc90fb8..312b4ec69f 100644 --- a/tests/testtreeview.c +++ b/tests/testtreeview.c @@ -626,17 +626,15 @@ create_tree_model (void) GtkTreeStore *store; gint i; GType *t; - volatile GType dummy; /* G_GNUC_CONST makes the optimizer remove - * get_type calls if you don't do something - * like this - */ /* Make the tree more interesting */ - dummy = gtk_scrolled_window_get_type (); - dummy = gtk_label_get_type (); - dummy = gtk_hscrollbar_get_type (); - dummy = gtk_vscrollbar_get_type (); - dummy = pango_layout_get_type (); + /* - we need this magic here so we are sure the type ends up being + * registered and gcc doesn't optimize away the code */ + g_type_class_unref (g_type_class_ref (gtk_scrolled_window_get_type ())); + g_type_class_unref (g_type_class_ref (gtk_label_get_type ())); + g_type_class_unref (g_type_class_ref (gtk_hscrollbar_get_type ())); + g_type_class_unref (g_type_class_ref (gtk_vscrollbar_get_type ())); + g_type_class_unref (g_type_class_ref (pango_layout_get_type ())); t = get_model_types ();