GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pango Error From gtk_widget_show and gtk_widget_show_all

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Brian Alexander



Joined: 25 Jan 2006
Posts: 1
Location: Blacksburg, VA

PostPosted: Wed Jan 25, 2006 3:49 pm    Post subject: Pango Error From gtk_widget_show and gtk_widget_show_all Reply with quote

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: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#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/
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 474
Location: Portland, OR USA

PostPosted: Thu Mar 09, 2006 7:10 pm    Post subject: Reply with quote

It compiles and runs fine for me using what you posted and gtk_widget_show_all on the window. I used the following to compile it:
Code: (Plaintext)
1
gcc -o test -Wall -g main.c `pkg-config gtk+-2.0 --cflags --libs`


However, I'm using GTK+ 2.6.10 still.

- Micah
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP