GNOME Bugzilla – Bug 686152
Calls gdk_window_get_frame_extents with a potentially NULL window
Last modified: 2012-10-22 23:43:14 UTC
Created attachment 226466 [details] [review] Patch that fixes the issue When running orca and libreoffice in unity-panel-service sometimes there is a call to gtk_widget_get_window that returns a NULL window, this patch makes sure we do not pass that NULL window to gdk_window_get_frame_extents as otherwise we get a crash. This is related to https://bugs.launchpad.net/unity/+bug/1064992
I don't think that is right. We have tons of calls to gtk_widget_get_window in gtk that rely on the return value not being NULL. That needs to be tracked down, not worked around in one place.
Well, but then gtk_widget_get_window documentation explicitely mentions it can return NULL, so I don't see why relying on it not being NULL as you say is correct. What do you want "to be tracked down"? Why a function returns NULL when it says it will? Can you please be a more specific in what you want me to do?
Well, actually looking a bit further up in the same function, there's some funny code: gdk_window = gtk_widget_get_window (widget); if (window) { state = gdk_window_get_state (gdk_window); ... which was probably meant to check gdk_window - and since that is already there, lets just go with the same check further down. The alternative would be to look for the widget state and avoid doing these calls if the widget is not realized.
Looking around a bit more, the entire file needs an audit for when it checks window for NULL.
The gdk_window = gtk_widget_get_window (widget); if (window) is in a different function gtk_window_accessible_ref_state_set vs gtk_window_accessible_get_extents If you want I can change that if too. About the "the entire file needs an audit for when it checks window for NULL" do you want me to go and fix all the gtk_widget_get_window so they are checked for null returns?