weird gdb/python/gtk/pango interaction?



Folks,

I'm no longer able to run PyGtk scripts from gdb under some circumstances.
I am using the CVS HEAD of glib, atk, pango, gtk+ and pygtk.  The following
simple Python script works fine when run from gdb:

    #!/usr/bin/env python

    import gtk

    w = gtk.Window()
    w.connect("destroy", gtk.mainquit)
    #lbl = gtk.Label("hi")
    #w.add(lbl)

    w.show_all()
    gtk.mainloop()

with the following output:

    (gdb) r basic.py
    Starting program: /usr/local/bin/python basic.py
    [New Thread 1024 (LWP 19044)]
    Gtk-Message: YOU ARE USING THE DEVEL BRANCH 1.3.x OF GTK+ WHICH IS CURRENTLY
                    UNDER HEAVY DEVELOPMENT AND FREQUENTLY INTRODUCES INSTABILITIES.                if you don't know why you are getting this, you probably want to                use the stable branch which can be retrieved from
                    ftp://ftp.gtk.org/pub/gtk/v1.2/ or via CVS with
                    cvs checkout -r glib-1-2 glib; cvs checkout -r gtk-1-2 gtk+

    Program exited normally.

If I uncomment the two lines involving lbl, however, I get this mess:

    (gdb) r basic.py
    Starting program: /usr/local/bin/python basic.py
    [New Thread 1024 (LWP 19127)]
    Gtk-Message: YOU ARE USING THE DEVEL BRANCH 1.3.x OF GTK+ WHICH IS CURRENTLY
                    UNDER HEAVY DEVELOPMENT AND FREQUENTLY INTRODUCES INSTABILITIES.                if you don't know why you are getting this, you probably want to                use the stable branch which can be retrieved from
                    ftp://ftp.gtk.org/pub/gtk/v1.2/ or via CVS with
                    cvs checkout -r glib-1-2 glib; cvs checkout -r gtk-1-2 gtk+

    basic.py (pid:19127): GRuntime-CRITICAL **: file gparamspecs.c: line 1687 (g_param_spec_float): assertion `default_value >= minimum && default_value <= maximum' failed

    basic.py (pid:19127): GRuntime-CRITICAL **: file gobject.c: line 270 (g_object_class_install_property): assertion `G_IS_PARAM_SPEC (pspec)' failed

    basic.py (pid:19127): ** WARNING **: Couldn't load font "Sans -2.09715e+06" falling back to "Sans -2.09715e+06"

    basic.py (pid:19127): ** WARNING **: Couldn't load font "Sans -2.09715e+06" falling back to "Sans -2.09715e+06"

    basic.py (pid:19127): ** WARNING **: All font failbacks failed!!!!

    Program exited with code 01.

If I change the Label to an EventBox, everything works, presumably because
no font rendering is involved.  Also when I run the script from the bash
prompt it works as expected (no Gtk warnings).  The equivalent C program:

    #include <gtk/gtk.h>

    int main( int   argc,
              char *argv[] )
    {
        GtkWidget *window;
        GtkWidget *label;

        gtk_init(&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_signal_connect (GTK_OBJECT (window), "destroy",
                            GTK_SIGNAL_FUNC(gtk_main_quit),
                            NULL);
        gtk_window_set_title (GTK_WINDOW (window), "");

        label = gtk_label_new("hi");
        gtk_container_add(GTK_CONTAINER(window), label);

        gtk_widget_show_all (GTK_WIDGET(window));
        gtk_main();

        return(0);
    }

works as expected, both from the command line and if run from the gdb
prompt.

This wouldn't be such a big deal, except in a more complex script I get
segfaults in some circumstances, and this makes debugging that problem a bit
difficult.

Any idea what's going on?

-- 
Skip Montanaro (skip pobox com)
http://www.mojam.com/
http://www.musi-cal.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]