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 744942 - gdk:quartz: Avoid segfaulting when calling gdk_window_ensure_native
gdk:quartz: Avoid segfaulting when calling gdk_window_ensure_native
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
3.14.x
Other Mac OS
: Normal normal
: Small fix
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-02-22 12:09 UTC by Thibault Saunier
Modified: 2015-02-22 18:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix the segfault avoid to dereference attributes when it is NULL and use the GdkWindow directly to get the window_type (1.58 KB, patch)
2015-02-22 12:09 UTC, Thibault Saunier
none Details | Review
gdk/quartz: Fix mixup in attributes usage creating window implementation (1.62 KB, patch)
2015-02-22 12:09 UTC, Thibault Saunier
accepted-commit_now Details | Review

Description Thibault Saunier 2015-02-22 12:09:02 UTC
Created attachment 297565 [details] [review]
Fix the segfault avoid to dereference attributes when it is NULL and use the GdkWindow directly to get the window_type

Currently calling gdk_window_ensure_native on a Drawing area leads to segfault because of a bug in _gdk_quartz_display_create_window_impl

You can reproduce the segfault running playback-test from gst-plugins-base: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/tests/examples/playback

I attach here a patch that fixes that issue (tested on mac OS 10.9 and Gtk 3.14.1)
Comment 1 Thibault Saunier 2015-02-22 12:09:48 UTC
Created attachment 297566 [details] [review]
gdk/quartz: Fix mixup in attributes usage creating window implementation

First, attributes can be NULL (which is always the case when calling
gdk_window_ensure_native) so do not unconditionally dereference it.

Then the window_type should be taken directly from the GdkWindow as
in other backends (such as the X11 one for example).
Comment 2 Emmanuele Bassi (:ebassi) 2015-02-22 13:15:57 UTC
Review of attachment 297566 [details] [review]:

looks good to me.
Comment 3 Thibault Saunier 2015-02-22 14:53:44 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #2)
> Review of attachment 297566 [details] [review] [review]:
> 
> looks good to me.

Should I just push it myself then? Also are you ok about cherry-pikcing it on the gtk-3.14 branch?
Comment 4 Emmanuele Bassi (:ebassi) 2015-02-22 15:00:07 UTC
If you have the commit bit on git.gnome.org, feel free to push this commit.

Cherry-picking to gtk-3-14 is also okay, from my side.
Comment 5 Thibault Saunier 2015-02-22 18:45:16 UTC
commit fb581a1084ed8949c6b8c666f07a3239153c03f6
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Sun Feb 22 13:01:17 2015 +0100

    gdk/quartz: Fix mixup in attributes usage creating window implementation
    
    First, attributes can be NULL (which is always the case when calling
    gdk_window_ensure_native) so do not unconditionally dereference it.
    
    Then the window_type should be taken directly from the GdkWindow as
    in other backends (such as the X11 one for example).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744942