atom feed3 messages in org.gnome.gtk-app-devel-listRe: Gtk-CRITICAL **: gtk_widget_event...
FromSent OnAttachments
Stefan KostMar 28, 2007 11:41 pm 
David Nečas (Yeti)Mar 29, 2007 5:15 am 
Stefan KostApr 2, 2007 6:34 am 
Subject:Re: Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
From:David Nečas (Yeti) (ye@physics.muni.cz)
Date:Mar 29, 2007 5:15:23 am
List:org.gnome.gtk-app-devel-list

On Thu, Mar 29, 2007 at 08:41:39AM +0200, Stefan Kost wrote:

I am looking for some tips of how to get the culprit for the above mentioned warning. I have a notebook with 5 pages. On the first tab I have a gnome-canvas with some items on. For that I have registered an event handler to move objects on the canvas. The moving part works fine. When I press a key I get the assertion. Still eveything works. Of course I'd like to fix it anyway. So I run the app as G_DEBUG="fatal_warnings" gdb ~/buzztard/bin/bt-edit and dump a backtrace: [Switching to Thread -1225189712 (LWP 20028)] 0xb748509b in g_logv (log_domain=<value optimized out>, log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s' failed", args1=0xbf93f4bc "]\207???k??@m??\002") at gmessages.c:493 493 G_BREAKPOINT (); (gdb) bt #0 0xb748509b in g_logv (log_domain=<value optimized out>, log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s' failed", args1=0xbf93f4bc "]\207???k??@m??\002") at gmessages.c:493 #1 0xb7485325 in g_log (log_domain=0xb7ac6ba7 "Gtk", log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s' failed") at gmessages.c:517 #2 0xb748540b in g_return_if_fail_warning (log_domain=0xb7ac6ba7 "Gtk", pretty_function=0xb7b7875d "gtk_widget_event", expression=0xb7b76be8 "WIDGET_REALIZED_FOR_EVENT (widget, event)") at gmessages.c:532 #3 0xb7a87769 in IA__gtk_widget_event (widget=0x833e288, event=0x834b900) at gtkwidget.c:3927 #4 0xb7a95354 in IA__gtk_window_propagate_key_event (window=0x81f0808, event=0x834b900) at gtkwindow.c:4799

The key point is probably here. Gtk+ must think the widget has keyboard focus for some reason -- or rather Gtk+ gives the widget focus for some reason. So you have to find out why.

...

and on it goes. None of my stuff there except below gtk_main. Now unfortunately the assertion dos not tell which widget is not realized. So I do: (gdb) select-frame 3 (gdb) print g_type_name(((GTypeClass*)((GTypeInstance*)widget)->g_class)->g_type) $1 = (gchar *) 0x8335450 "BtPatternView"

Well this is a subclassed widget that is on the 2nd tab of the notbook. The "BtPatternView" subclasses a GtkTreeView, overrides realize, unrealize, expose, dispose and finalize. It does the chaining up.

Still, knowing normal GtkTreeView behaves the same would decrease the number of unknonws.

When I initially click thru all tabs (so that they get realized it infact works). Explicitely calling gtk_widget_show() on it doesn't help. So any idea what goes wrong here?

No ideas what goes wrong, but some ideas what to try to debug it: - run with G_OBJECT_DEBUG=signals and look for is-focus in the youtput, maybe you'll see a pattern, unfortunately it may not be detailed enough - watch all changes of window->focus_widget in gtkwindow.c and actions of set_focus_child() of relevant containers, probably by manual insertions of some debugging messages, although one can use gdb facilities too

Yeti