Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking up a deactivated widget's ancestor is unsafe #11

Closed
z234009184 opened this issue Mar 26, 2020 · 11 comments
Closed

Looking up a deactivated widget's ancestor is unsafe #11

z234009184 opened this issue Mar 26, 2020 · 11 comments

Comments

@z234009184
Copy link

════════ Exception caught by scheduler library ═════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
Looking up a deactivated widget's ancestor is unsafe.

At this point the state of the widget's element tree is no longer stable.

To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.

When the exception was thrown, this was the stack:
#0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:3508:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:3522:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:3564:12)
#3 MediaQuery.of (package:flutter/src/widgets/media_query.dart:793:38)
#4 _AwsomeVideoPlayerState.initState.. (package:awsome_video_player/src/video.dart:113:38)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

@z234009184
Copy link
Author

作者您好,非常感谢您开源这么强大的库!!
我在使用的过程中遇到了这个错误, 可以帮我看下什么原因么?
感谢

@chudongvip
Copy link
Owner

者您好,非常感谢您开源这么强大的库!!
我在使用的过程中遇到了这个错误, 可以帮我看下什么原因么?
感谢

收到,请问你用的是模拟器还是真机,系统版本以及型号提供一下

@z234009184
Copy link
Author

z234009184 commented Mar 26, 2020

者您好,非常感谢您开源这么强大的库!!
我在使用的过程中遇到了这个错误, 可以帮我看下什么原因么?
感谢

收到,请问你用的是模拟器还是真机,系统版本以及型号提供一下

您好, 我使用的是 iPhone 7 真机, iOS 13.3.1
发生在 onpop 回调中调用 Navigator.pop(context);

@z234009184
Copy link
Author

z234009184 commented Mar 26, 2020

经过测试, 我发现好像是在 Navigator.pop(context) 之后, 播放器内部的MediaQuery.of 不断的使用 context 而引发, 不知道是不是这样

@chudongvip
Copy link
Owner

经过测试, 我发现好像是在 Navigator.pop(context) 之后, 播放器内部的MediaQuery.of 不断的使用 context 而引发, 不知道是不是这样

好的,安排。ps: 你是单页面还是多页面,播放器是在首页还是子页面调用 Navigator.pop

@z234009184
Copy link
Author

z234009184 commented Mar 27, 2020

好的,安排。ps: 你是单页面还是多页面,播放器是在首页还是子页面调用 Navigator.pop

您好, 播放器是在子页面进行的 Navigator.pop(context)

jeromexiong added a commit that referenced this issue Mar 27, 2020
@seekcx
Copy link

seekcx commented Mar 27, 2020

一样的问题,不知道是不是我在一个list里使用了多个导致的。

@chudongvip
Copy link
Owner

一样的问题,不知道是不是我在一个list里使用了多个导致的。

等我发布新的版本,你再试试,今天晚上发一版

@niicolasalves
Copy link

Hello, I have the same problem. In my case, I am using a PageView and when leaving the page with the player and returning it is in a loop repeating this error.

════════ Exception caught by scheduler library ═════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
════════════════════════════════════════════════════════════════════════════════

Running on a real device on Android 9.

@chudongvip
Copy link
Owner

Hello, I have the same problem. In my case, I am using a PageView and when leaving the page with the player and returning it is in a loop repeating this error.

════════ Exception caught by scheduler library ═════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
════════════════════════════════════════════════════════════════════════════════

Running on a real device on Android 9.

Thanks for your feedback. This is a know BUG that i have fixed and i'll release a version today.

@chudongvip
Copy link
Owner

@niicolasalves @z234009184 I'll fixed this bug with the version 1.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants