# HG changeset patch # User Goffi # Date 1553070584 -3600 # Node ID 23d4358803c7d0c18608554cdd8a0decef2c1276 # Parent 89ba66464329557e9c42a850e4bdfcf998d2b51f widgets_handler: work around the double call of onSlideChange: with Kivy dev version a95d67f (the one currently used in Python for Android), onSlideChange which is binded on current_slide was called twice with the same widget, resulting in widgets unexpectedly deleted. This patch fixes it by abording the callback if new_slide is the same as _former_slide, i.e. if the widget is not actually changed. Started a discussion with upstream Kivy team to check if this is a bug or feature. diff -r 89ba66464329 -r 23d4358803c7 cagou/core/widgets_handler.py --- a/cagou/core/widgets_handler.py Wed Mar 20 09:29:44 2019 +0100 +++ b/cagou/core/widgets_handler.py Wed Mar 20 09:29:44 2019 +0100 @@ -326,6 +326,11 @@ def onSlideChange(self, handler, new_slide): if self._former_slide is not None: + if self._former_slide is new_slide: + # FIXME: workaround for Kivy a95d67f (and above?), Carousel.current_slide + # binding now calls onSlideChange twice with the same widget (here + # "new_slide"). To be checked with Kivy team. + return G.host._removeVisibleWidget(self._former_slide) self._former_slide = new_slide if new_slide is not None: