[libadwaita/wip/exalm/carousel-fix: 4/4] carousel: Fix crash with 2 overlapping animations




commit afee03698b0ab155ebad51b6e3f364f234b2e16c
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Jun 2 14:14:51 2021 +0500

    carousel: Fix crash with 2 overlapping animations
    
    If we start an animation while one is already running, we first set the
    state for the new animation, then stop the old animation resetting the same
    state, then start the new animation with the empty state. We should stop it
    first, then set the state.
    
    Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/185

 src/adw-carousel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index 9d5cb76b..3cddcfd9 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -374,12 +374,12 @@ scroll_to (AdwCarousel *self,
            GtkWidget   *widget,
            gint64       duration)
 {
-  self->animation_source_position = self->position;
-  self->animation_target_child = find_child_info (self, widget);
-
   if (self->animation)
     adw_animation_stop (self->animation);
 
+  self->animation_source_position = self->position;
+  self->animation_target_child = find_child_info (self, widget);
+
   self->animation =
     adw_animation_new (GTK_WIDGET (self), 0, 1, duration,
                        adw_ease_out_cubic,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]