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 607825 - [StButton] Hold ref to button until animation completes
[StButton] Hold ref to button until animation completes
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-01-22 23:54 UTC by Colin Walters
Modified: 2010-01-26 21:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[StButton] Hold ref to button until animation completes (1.47 KB, patch)
2010-01-22 23:54 UTC, Colin Walters
accepted-commit_now Details | Review
valgrind log snippet (3.58 KB, text/plain)
2010-01-22 23:58 UTC, Colin Walters
  Details
backtrace (2.79 KB, text/plain)
2010-01-23 21:08 UTC, drago01
  Details
[StButton] Hold ref to self until animation completes (2.18 KB, patch)
2010-01-26 19:29 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2010-01-22 23:54:50 UTC
StButton has an internal animation for the border-image actor, then
it connects to the "completed" signal passing itself as data.  However,
if the button is destroyed, nothing prevents the animation's completed
signal from then causing a reference to freed memory.

Holding a reference to the button is the most straightforward fix here.
Comment 1 Colin Walters 2010-01-22 23:54:53 UTC
Created attachment 152055 [details] [review]
[StButton] Hold ref to button until animation completes
Comment 2 Colin Walters 2010-01-22 23:58:25 UTC
Created attachment 152056 [details]
valgrind log snippet

Relevant valgrind trace
Comment 3 drago01 2010-01-23 21:08:42 UTC
Created attachment 152110 [details]
backtrace

Not sure if this is related but it seems that this is not the only crasher (was running with this patch after Colin suggested it on IRC).

Backtrace is attached; if you want me to file a new bug just ask.
Comment 4 Dan Winship 2010-01-26 18:26:26 UTC
Comment on attachment 152055 [details] [review]
[StButton] Hold ref to button until animation completes

I am a tiny bit worried that this could leak the button if, for some reason, "completed" was not emitted. Another possibility would be to do

    anim = clutter_actor_get_animation (CLUTTER_ACTOR (gobject));
    if (anim)
      clutter_animation_completed (anim);

from st_button_dispose().

However, I'm not especially familiar with ClutterAnimation, and maybe there's really nothing to worry about here.
Comment 5 Colin Walters 2010-01-26 19:29:24 UTC
Created attachment 152332 [details] [review]
[StButton] Hold ref to self until animation completes

StButton has an internal animation for the border-image actor, then
it connects to the "completed" signal passing itself as data.  However,
if the button is destroyed, nothing prevents the animation's completed
signal from then causing a reference to freed memory.

Holding a reference to the button is the most straightforward fix here.
Comment 6 Dan Winship 2010-01-26 21:10:00 UTC
Comment on attachment 152332 [details] [review]
[StButton] Hold ref to self until animation completes

meh. that unref in st_button_dispose_old_bg seems pretty magical. i like the first version better. your call.

hm... and does this do the right thing if the style changes, and then changes again while the first animation is still in progress?
Comment 7 Colin Walters 2010-01-26 21:26:26 UTC
(In reply to comment #6)
> (From update of attachment 152332 [details] [review])
> meh. that unref in st_button_dispose_old_bg seems pretty magical. i like the
> first version better. your call.

I'm more confident in this one.

> hm... and does this do the right thing if the style changes, and then changes
> again while the first animation is still in progress?

I believe so, because we call st_button_dispose_old_bg as the first thing in style_changed, which will unref if we had an animation in progress.
Comment 8 Colin Walters 2010-01-26 21:26:48 UTC
Attachment 152332 [details] pushed as d7e0051 - [StButton] Hold ref to self until animation completes