π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix memory leak by properly disposing ValueNotifier
ashilknccbf46d4a19e
diff --git a/mobile/apps/photos/lib/states/detail_page_state.dart b/mobile/apps/photos/lib/states/detail_page_state.dartindex ae0ead02c0..bcfdf3560a 100644--- a/mobile/apps/photos/lib/states/detail_page_state.dart+++ b/mobile/apps/photos/lib/states/detail_page_state.dart@@ -12,10 +12,13 @@ typedef FullScreenRequestCallback = void Function();class InheritedDetailPageState extends InheritedWidget {- final enableFullScreenNotifier = ValueNotifier(false);+ final ValueNotifier<bool> enableFullScreenNotifier;+ // Cannot be const because we accept a ValueNotifier instance at runtime+ // ignore: prefer_const_constructors_in_immutablesInheritedDetailPageState({super.key,required super.child,+ required this.enableFullScreenNotifier,});static InheritedDetailPageState of(BuildContext context) =>diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dartindex 85f299272c..c84e291461 100644--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart@@ -68,17 +68,33 @@ class DetailPageConfiguration {}}-class DetailPage extends StatelessWidget {+class DetailPage extends StatefulWidget {final DetailPageConfiguration config;const DetailPage(this.config, {super.key});+ @override+ State<DetailPage> createState() => _DetailPageState();+}++class _DetailPageState extends State<DetailPage> {+ final _enableFullScreenNotifier = ValueNotifier(false);++ @override+ void dispose() {+ _enableFullScreenNotifier.dispose();+ super.dispose();+ }+@overrideWidget build(BuildContext context) {// Separating body to a different widget to avoid// unnecessary reinitialization of the InheritedDetailPageState// when the body is rebuilt, which can reset state stored in it.- return InheritedDetailPageState(child: _Body(config));+ return InheritedDetailPageState(+ enableFullScreenNotifier: _enableFullScreenNotifier,+ child: _Body(widget.config),+ );}}