akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 379 forks source link

NPE in ^2.0.0+1 #244

Open bakua opened 3 years ago

bakua commented 3 years ago

Hello, I got this NPE.

Null check operator used on a null value. 
       at AnimationController.stop(AnimationController.java:777)
       at AnimationController.value=(AnimationController.java:364)
       at _SlidingUpPanelState._onGestureSlide(_SlidingUpPanelState.java:473)
       at _SlidingUpPanelState._gestureHandler.<fn>(_gestureHandler.java:461)
       at RenderPointerListener.handleEvent(RenderPointerListener.java:2823)
       at GestureBinding.dispatchEvent(GestureBinding.java:361)
       at RendererBinding.dispatchEvent(RendererBinding.java:278)
       at GestureBinding._handlePointerEventImmediately(GestureBinding.java:316)
       at GestureBinding.handlePointerEvent(GestureBinding.java:280)
       at GestureBinding._flushPointerEventQueue(GestureBinding.java:238)
       at GestureBinding._handlePointerDataPacket(GestureBinding.java:221)
akshathjain commented 3 years ago

Please attach the output of flutter doctor and a sample main.dart that reproduces the issue.

bakua commented 3 years ago

Hello,

I don't know how to reproduce it myslef. I got this error reported by Crashlytics.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (1 available)

• No issues found!
franco-stuart commented 2 years ago

I am having the same error. It is very difficult to reproduce, just sliding up and down very quickly and erratically until it crashes.

From Crashlitycs I get the same stacktrace.

But when reproduced, the assertion throws the error before reaching the null check operator.

Exception: 'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 771 pos 7: '_ticker != null': AnimationController.stop() called after AnimationController.dispose()
AnimationController methods should not be used after calling dispose. 
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2      AnimationController.stop (package:flutter/src/animation/animation_controller.dart:771:7)
#3      AnimationController.value= (package:flutter/src/animation/animation_controller.dart:364:5)
#4      _SlidingUpPanelState._onGestureSlide (package:sliding_up_panel/src/panel.dart:473:13)
#5      _SlidingUpPanelState._gestureHandler.<anonymous closure> (package:sliding_up_panel/src/panel.dart:461:9)
#6      RenderPointerListener.handleEvent (package:flutter/src/rendering/proxy_box.dart:2831:29)
#7      GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#8      RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287:11)
#9      GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#10     GestureBinding.handlePointerEvent (package:flutter/src/ge<…>

If the Panel gets disposed while the animation is played it crashes. _onGestureSlide tries to update it after it was disposed.

franco-stuart commented 2 years ago

I created this PR: https://github.com/akshathjain/sliding_up_panel/pull/278