After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686152 - Calls gdk_window_get_frame_extents with a potentially NULL window
Calls gdk_window_get_frame_extents with a potentially NULL window
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-10-15 13:57 UTC by Albert Astals Cid
Modified: 2012-10-22 23:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that fixes the issue (1.08 KB, patch)
2012-10-15 13:57 UTC, Albert Astals Cid
none Details | Review

Description Albert Astals Cid 2012-10-15 13:57:38 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
Comment 1 Matthias Clasen 2012-10-15 20:34:01 UTC
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.
Comment 2 Albert Astals Cid 2012-10-16 07:39:37 UTC
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?
Comment 3 Matthias Clasen 2012-10-16 16:43:42 UTC
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.
Comment 4 Matthias Clasen 2012-10-16 16:45:58 UTC
Looking around a bit more, the entire file needs an audit for when it checks window for NULL.
Comment 5 Albert Astals Cid 2012-10-17 11:08:15 UTC
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?