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 735226 - Avoid NULL surface access if a window is shown/hidden within a frame
Avoid NULL surface access if a window is shown/hidden within a frame
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-22 14:47 UTC by Carlos Garnacho
Modified: 2014-09-01 20:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Avoid NULL surface access if the window is shown/hidden within a clock frame (1.00 KB, patch)
2014-08-22 14:48 UTC, Carlos Garnacho
none Details | Review
wayland: Unset window_impl->commit_pending when hiding the surface (970 bytes, patch)
2014-09-01 18:26 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2014-08-22 14:47:04 UTC
When investigating bug #734374, I've sometimes seen crashes when triggering the xdg_popup misbehaviors on touch. Those seem to be due to the popup window being shown and hidden through popup_done whithin a single frame, so the window GdkFrameClock gets to be started, but impl->surface is already NULL at the time after_paint() is called.

I'm attaching a patch to add a check for the window being mapped at that time, in order to avoid NULL access.
Comment 1 Carlos Garnacho 2014-08-22 14:48:57 UTC
Created attachment 284219 [details] [review]
wayland: Avoid NULL surface access if the window is shown/hidden within a clock frame

In these cases the frame is already scheduled, but impl->surface is already NULL at the
time on_frame_clock_after_paint() is called.
Comment 2 Matthias Clasen 2014-08-23 23:14:30 UTC
wouldn't it be more correct to unset pending_commit when hiding the window ?
Comment 3 Carlos Garnacho 2014-09-01 18:26:16 UTC
Created attachment 285049 [details] [review]
wayland: Unset window_impl->commit_pending when hiding the surface

A surface may be hidden when a frame is already scheduled, which may cause
crashes on on_frame_clock_after_paint() when calling commit() on a NULL
surface. To fix this, ensure commit_pending is also set to FALSE when the
surface is gone.
Comment 4 Matthias Clasen 2014-09-01 19:46:43 UTC
Review of attachment 285049 [details] [review]:

ok
Comment 5 Carlos Garnacho 2014-09-01 20:46:25 UTC
Attachment 285049 [details] pushed as 7fbac57 - wayland: Unset window_impl->commit_pending when hiding the surface