Re: GTK critical assertion : WIDGET_REALIZED_FOR_EVENT




On Jan 3, 2007, at 11:48 PM, Ashwin Ramachandran wrote:

HI All,
I am using Perl-Gtk2 and observing this assertion, once in a while, when the application is opened:

==================================================================
$ Gtk-CRITICAL **: gtk_widget_event: assertion
`WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
at /usr/share/osfr/tools/ddore.pl line 1192.
Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT
(widget, event)' failed at /usr/share/osfr/tools/ddore.pl line 1192.



The line #1192 the assertion points to is
    main Gtk2; <-----
    exit( 0 );

I am not sure why this assertion is happening, since I am not able to debug further[since it points to the event loop].

It points to the Gtk2::main line because that was the location of the last perl statement executed before the error. When these assertion messages are emitted, they are run through a log message handler which appends the perl file and line number with the Carp utilities. What this means is that something you set up in the code prior to starting the main loop caused an assertion after the main loop started. This is unfortunately rather commonplace.

The actual assertion message that you're seeing is from inside gtk+. It means that a widget is trying to handle an event before that widget has been "realized" --- that is, there is no actual gdk window for the widget yet, so the widget can't handle the event. It's most likely that you have forgotten to show() some widget somewhere.


I am using Glade and building my main window using Glade files.

This makes it a little harder to debug, since we can't look at actual code to see which widgets aren't being show()n. Make sure that all the widgets you want to be live have their "visible" properties active, and that you have called show() on the toplevel window properly.


Just wanted to check if anyone in this group has encountered any similar problem? Is there any more data that I need to supply for this issue?

If you want to get your hands a little dirty, then you can actually run your program in both the perl and c debuggers and find out exactly where this assertion is failing; that often helps.



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