Re: GTK 2.16 assertion `GTK_IS_TEXT_LAYOUT (layout)' failed

Hi Again,
I created a test case in C that triggers this warning so it's not a
PyGtk issue. (attached)

The C test however always displays the warning after the container
remove action. So your assumption about PyGtk logger eating repeated
warnings is probably correct.

It could be a bug in my code I guess but as this has not been an issue
in any of the previous versions it could be due to changes in GTK.

I know that there has been some updates to the IM handling in 2.16,
maybe that can have something to do with it?


On Wed, Apr 1, 2009 at 1:20 PM, Tor Lillqvist <tml iki fi> wrote:
>> I just built and tested on gtk-2.16.0 on Linux and got the exact same
>> assertion warning.
>> However you said I should only file a bug if it was not present on Linux.
>> Any hints on what will happen now?
> Well, it could still be a bug in gtk+ of course, but maybe it is more
> probable that it is a bug in your code, or in pygtk, then?
> --tml
#include <gtk/gtk.h>
struct cb_struct
	GtkWidget *container;
	GtkWidget *widget;   

static void callback( GtkWidget *widget,
                      gpointer *cb_data)
    g_object_ref(G_OBJECT(((struct cb_struct*) cb_data)->widget));
    gtk_container_remove(GTK_CONTAINER(((struct cb_struct*) cb_data)->container),GTK_WIDGET(((struct cb_struct*) cb_data)->widget));
    gtk_box_pack_start (GTK_BOX(((struct cb_struct*) cb_data)->container), 
                        GTK_WIDGET(((struct cb_struct*) cb_data)->widget), TRUE, TRUE, 0);
    g_object_unref(G_OBJECT(((struct cb_struct*) cb_data)->widget));

static gboolean delete_event( GtkWidget *widget,
                              GdkEvent  *event,
                              gpointer   data )
    gtk_main_quit ();
    return FALSE;

int main( int   argc,
          char *argv[] )
    /* GtkWidget is the storage type for widgets */
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *textview;
    GtkWidget *box1;
    struct cb_struct cb_data;

    /* This is called in all GTK applications. Arguments are parsed
     * from the command line and are returned to the application. */
    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_window_set_title (GTK_WINDOW (window), "GTK 2.16.0 assertion warning test");

    g_signal_connect (G_OBJECT (window), "delete_event",
		      G_CALLBACK (delete_event), NULL);

    box1 = gtk_vbox_new (FALSE, 0);

    gtk_container_add (GTK_CONTAINER (window), box1);

    button = gtk_button_new_with_label ("Button 1");

    gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);

    gtk_widget_show (button);

    textview = gtk_text_view_new ();

    cb_data.container = box1;
    cb_data.widget = textview;

    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (callback),(gpointer) &cb_data);

    gtk_box_pack_start(GTK_BOX (box1), textview, TRUE, TRUE, 0);

    gtk_widget_show (textview);

    gtk_widget_show (box1);

    gtk_widget_show (window);
    /* Rest in gtk_main and wait for the fun to begin! */
    gtk_main ();

    return 0;

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