I am an experienced programmer but am new to GTK+. I have been trying to work through the
GTK+ 2.0 Tutorial. The project builds and runs so long as it does not call
gtk_widget_show() on the button widget. If
gtk_widget_show() is called the following error appears:
Quote:
Pango-ERROR **: file shape.c line 75 (pango_shape): assertion failed: (glyphs->num_glyphs > 0)
aborting...
I am guessing that I have made some mistake that is obvious to someone familiar with GTK+ but I really do not see the problem. The code for my project is below (the
gtk_widget_show(button) call is the problem line)
Code:
#include <gtk/gtk.h>
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application. */
gtk_init (&argc, &argv);
/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Here we connect the "destroy" event to a signal handler.
* This event occurs when we call gtk_widget_destroy() on the window,
* or if we return FALSE in the "delete_event" callback. */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Creates a new button with the label "Hello World". */
button = gtk_button_new_with_label ("Hello World");
/* This packs the button into the window (a gtk container). */
gtk_container_add (GTK_CONTAINER (window), button);
/* The final step is to display this newly created widget. */
// ***** FOLLOWING LINE CAUSES ERROR UNLESS COMMENTED OUT ****
gtk_widget_show (button);
/* and the window */
gtk_widget_show (window);
/* All GTK applications must have a gtk_main(). Control ends here
* and waits for an event to occur (like a key press or
* mouse event). */
gtk_main ();
return 0;
}
So, what am I doing wrong :?:
I had thought that the tutorial might simply be out of date but I have the same problem with the
gtk_widget_show_all() in the code outlined in
the
GTK+ Basics Chapter of
GTK+/Gnome Application Development
In case it matters I am using the following libraries:
- atk 1.10.3
- cairo 1.0.2
- glib 2.8.5
- gtk+ 2.8.9
- gettext 0.14.5
- libiconv 1.9.1
- libpng-config 0.20
- pango 1.10.2
- zlib 123
These were the most recent versions listed in the
win32 directory at
http://www.gtk.org/