[gtk+] tests: Make forcing of class registers work without gcc warnings
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Make forcing of class registers work without gcc warnings
- Date: Fri, 27 May 2011 14:19:26 +0000 (UTC)
commit 8c4653c4f2186d6c841d87db1f129455ab0374e8
Author: Benjamin Otte <otte redhat com>
Date: Fri May 27 04:20:45 2011 +0200
tests: Make forcing of class registers work without gcc warnings
tests/testtreeview.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 80efc90..312b4ec 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]