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 592567 - Dereferencing NULL in mutter_window_get_workspace()
Dereferencing NULL in mutter_window_get_workspace()
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Tomas Frydrych
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2009-08-21 11:59 UTC by Tomas Frydrych
Modified: 2009-10-09 15:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch not to derefence NULL per comment #0 (919 bytes, patch)
2009-08-21 12:00 UTC, Tomas Frydrych
committed Details | Review

Description Tomas Frydrych 2009-08-21 11:59:12 UTC
The function assumes that the MetaWindow is always on a workspace, which is not the case. I will attach a patch with adding a NULL check.
Comment 1 Tomas Frydrych 2009-08-21 12:00:58 UTC
Created attachment 141321 [details] [review]
Patch not to derefence NULL per comment #0
Comment 2 Owen Taylor 2009-08-24 18:37:17 UTC
Should that function just be removed? It's fundamentally confusing:

 window.get_meta_window().get_workspace();

Returns a MetaWorkspace.

 window.get_workspace();

returns the index. I think we should be getting rid of all the MutterWindow methods that are just propagating stuff from MetaWindow - a lot of that dates from past-history where override-redirect MutterWindow's didn't have a MetaWindow.

Not a strong feeling that that has to happen immediately - if you want to go ahead and commit this patch, feel free to do so. My only suggestion would be to add a doc comment that describes a) that it can return -1 and b) gives some indication of the circumstances that can occur.

Since if I was calling that function, I wouldn't expect it to return -1, and I would have no idea what it indicated when it did or what I should do.
Comment 3 Tomas Frydrych 2009-10-09 15:53:08 UTC
Comment on attachment 141321 [details] [review]
Patch not to derefence NULL per comment #0

I agree, we should at some point review the overlaps in the MutterWindow / MetaWindow API, and stream line it. For now, I have committed this patch with a doc comment noting that this function is deprecated.