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 671173 - Don't segfault when queueing a redraw from a ::queue-redraw handler
Don't segfault when queueing a redraw from a ::queue-redraw handler
Status: RESOLVED OBSOLETE
Product: clutter
Classification: Platform
Component: ClutterActor
unspecified
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-01 22:03 UTC by Giovanni Campagna
Modified: 2021-06-10 11:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ClutterActor: clear redraw entry before emitting signals (1.57 KB, patch)
2012-03-01 22:03 UTC, Giovanni Campagna
committed Details | Review
gnome-shell stack trace (1.03 KB, text/plain)
2012-03-02 14:08 UTC, Giovanni Campagna
  Details

Description Giovanni Campagna 2012-03-01 22:03:20 UTC
See the patch - I hope it's clear enough how it happens (and indeed it happened to me a few times with gnome-shell, despite seeming the edge of an edge case)
Comment 1 Giovanni Campagna 2012-03-01 22:03:43 UTC
Created attachment 208825 [details] [review]
ClutterActor: clear redraw entry before emitting signals

If the redraw entry is not cleared, queueing a redraw from a signal
handler could reinsert the same object in the stage redraw list,
causing the segfault later (as the object is immediately freed)
Comment 2 Emmanuele Bassi (:ebassi) 2012-03-01 22:39:16 UTC
Review of attachment 208825 [details] [review]:

looks okay to me.
Comment 3 Giovanni Campagna 2012-03-01 22:46:28 UTC
Attachment 208825 [details] pushed as 018ede2 - ClutterActor: clear redraw entry before emitting signals
Comment 4 Giovanni Campagna 2012-03-02 14:06:25 UTC
I got the same crash despite the patch, reopening...
Comment 5 Giovanni Campagna 2012-03-02 14:08:04 UTC
Created attachment 208851 [details]
gnome-shell stack trace

Attaching stack trace, in case someone has a better clue of the cause...
Comment 6 Giovanni Campagna 2012-03-02 14:18:44 UTC
In fact, the patch only addressed queueing a redraw for the same actor that emitted ::queue-redraw. If you queue_redraw() on another actor that is already on the list, and not yet processed (and thus has still has a redraw entry), you still end up placing the same object on the list.

But before I start coding a fix (which would involve refcounting the entry structure)... does what I'm saying make any sense to you, clutter devs?
Comment 7 Emmanuele Bassi (:ebassi) 2012-03-02 14:42:31 UTC
I'm not entirely sure we want to unconditionally allow queueing redraws on actors already marked as dirty - including their children.

if a child of an actor queues a redraw, and the request bubbles up to an actor already marked for redraw, we should just bail out - given the assumption that an actor that is marked to be redrawn will have to redraw its children as well.
Comment 8 Emmanuele Bassi (:ebassi) 2012-03-02 14:42:55 UTC
this may or may not be further complicated by the presence of effects on the actor.
Comment 9 Giovanni Campagna 2012-03-02 15:42:16 UTC
(In reply to comment #7)
> I'm not entirely sure we want to unconditionally allow queueing redraws on
> actors already marked as dirty - including their children.
> 
> if a child of an actor queues a redraw, and the request bubbles up to an actor
> already marked for redraw, we should just bail out - given the assumption that
> an actor that is marked to be redrawn will have to redraw its children as well.

Well, from a deeper reading of the code turns out that it already does so: _clutter_stage_queue_actor_redraw does not add the actor to the pending_queue_redraws list if it already has a redraw entry. Bah...
Comment 10 André Klapper 2021-06-10 11:33:49 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of clutter, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a ticket at
  https://gitlab.gnome.org/GNOME/clutter/-/issues/

Thank you for your understanding and your help.