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

fix(photo_view): Looking up a deactivated widget's ancestor is unsafe #202

Merged
merged 1 commit into from
Feb 13, 2022

Conversation

aman-singh7
Copy link
Member

Fixes #

Describe the changes you have made in this PR - I have overridden the package photo_view because of the above-mentioned exception thrown by this package.

Stacktrace:-

======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
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.<anonymous closure> (package:flutter/src/widgets/framework.dart:4153:9)
#1      Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4167:6)
#2      Element.getElementForInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4193:12)
#3      TickerMode.getNotifier (package:flutter/src/widgets/ticker_provider.dart:96:50)
#4      TickerProviderStateMixin._updateTickerModeNotifier (package:flutter/src/widgets/ticker_provider.dart:327:56)
#5      TickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:291:7)
#6      new AnimationController (package:flutter/src/animation/animation_controller.dart:246:21)
#7      PhotoViewCoreState._scaleAnimationController (package:photo_view/src/core/photo_view_core.dart:112:7)
#8      PhotoViewCoreState._scaleAnimationController (package:photo_view/src/core/photo_view_core.dart)
#9      PhotoViewCoreState.dispose (package:photo_view/src/core/photo_view_core.dart:274:5)
#10     StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4983:11)
#11     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1926:13)
#12     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#13     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#14     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#15     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#16     _LayoutBuilderElement.visitChildren (package:flutter/src/widgets/layout_builder.dart:71:14)
#17     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#18     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#19     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#20     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#21     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#22     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#23     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#24     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#25     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#26     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#27     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#28     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#29     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#30     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#31     MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6386:16)
#32     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#33     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#34     MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6386:16)
#35     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#36     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#37     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#38     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#39     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#40     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#41     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#42     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#43     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#44     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#45     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#46     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#47     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#48     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#49     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#50     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#51     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#52     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#53     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#54     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#55     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#56     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#57     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#58     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#59     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#60     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#61     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#62     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#63     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#64     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#65     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#66     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#67     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#68     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#69     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#70     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#71     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#72     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#73     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#74     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#75     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#76     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#77     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#78     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#79     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#80     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#81     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#82     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#83     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#84     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#85     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#86     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#87     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#88     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#89     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#90     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#91     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#92     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#93     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#94     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#95     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#96     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#97     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#98     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#99     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#100    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#101    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#102    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#103    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#104    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#105    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#106    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#107    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#108    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#109    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#110    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#111    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#112    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#113    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#114    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#115    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#116    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#117    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#118    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#119    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#120    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#121    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#122    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#123    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#124    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#125    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#126    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#127    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#128    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#129    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#130    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#131    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#132    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#133    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#134    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#135    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#136    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#137    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#138    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#139    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#140    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#141    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#142    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#143    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#144    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#145    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#146    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#147    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#148    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#149    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#150    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#151    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#152    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#153    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#154    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#155    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#156    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#157    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#158    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#159    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#160    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#161    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#162    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#163    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#164    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#165    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#166    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6271:14)
#167    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#168    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#169    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#170    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#171    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#172    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#173    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#174    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1924:7)
#175    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4807:14)
#176    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
#177    ListIterable.forEach (dart:_internal/iterable.dart:39:13)
#178    _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:1935:25)
#179    BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2519:15)
#180    BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:2932:7)
#181    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:19)
#182    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#183    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#184    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1081:9)
#185    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:995:5)
#189    _invoke (dart:ui/hooks.dart:151:10)
#190    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#191    _drawFrame (dart:ui/hooks.dart:115:31)
(elided 3 frames from dart:async)
====================================================================================================

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

@Nitish145 Nitish145 merged commit 84d95d1 into CircuitVerse:master Feb 13, 2022
@aman-singh7 aman-singh7 deleted the photo_view_bug branch March 3, 2022 07:05
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

Successfully merging this pull request may close these issues.

2 participants