Skip to content

Commit

Permalink
Merge branch 'main' into feat/handle-symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Sep 19, 2023
2 parents 2c3dcf2 + 27d19d9 commit 3ed02c4
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/cookbook/design/themes/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
dependencies:
flutter:
sdk: flutter
google_fonts: ^5.1.0
google_fonts: ^6.0.0

dev_dependencies:
flutter_lints: ^2.0.2
Expand Down
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
{ "source": "/go/go-router-v8-breaking-changes", "destination": "https://docs.google.com/document/d/1VCuB85D5kYxPR3qYOjVmw8boAGKb7k62heFyfFHTOvw/edit?usp=sharing", "type": 301 },
{ "source": "/go/go-router-v9-breaking-changes", "destination": "https://docs.google.com/document/d/16plvWc9ablQsUs7w6bWDpTZ7PwMP4YUhV-qMQ3iljE0/edit?usp=sharing", "type": 301 },
{ "source": "/go/go-router-v10-breaking-changes", "destination": "https://docs.google.com/document/d/1vjupshmFJtfGSOppZxp7Tzkq7dotcLxCcpdluuNYe1o/edit?usp=sharing&resourcekey=0-aS66t4OcDTjJW50s-veSzQ", "type": 301 },
{ "source": "/go/go-router-v11-breaking-changes", "destination": "https://docs.google.com/document/d/1L2LPM_DBqKQx1pTRRfG7pi33P88iAypBju65rcMW_dU/edit?usp=sharing", "type": 301 },
{ "source": "/go/handling-synchronous-keyboard-events", "destination": "https://docs.google.com/document/d/1rWXSjkb2ZKv-cpg26lVK0aZi4cVeXJ8j7YmSJdq2TOM/edit", "type": 301 },
{ "source": "/go/hermetic-xcode-installation", "destination": "https://docs.google.com/document/d/1EcXm4Woq48GR_ky07mEJka6NfV1vFBN2OHDEeGfPk34/edit?resourcekey=0-0Gjtt1I66mGJ8AwiCTlFNw", "type": 301 },
{ "source": "/go/hero-refactor", "destination": "https://docs.google.com/document/d/1JZVqykFjhDXcJyj_Ep5gfTmF-Eu4pQXXNRcLCN04tls/edit?usp=sharing", "type": 301 },
Expand Down
63 changes: 63 additions & 0 deletions src/release/breaking-changes/dispose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Added missing `dispose()` for some disposable objects in Flutter
description: >
'dispose()' might fail because of double disposal.
---

## Summary

Missing calls to 'dispose()' are added for some disposable objects.
For example, ContextMenuController did not dispose OverlayEntry,
and EditableTextState did not dispose TextSelectionOverlay.

If some other code also invokes 'dispose()' for the object,
and the object is protected from double disposal,
the second 'dispose()' fails with the following error message:

`Once you have called dispose() on a <class name>, it can no longer be used.`

## Background

The convention is that the owner of an object should dispose of it.

This convention was broken in some places:
owners were not disposing the disposable objects.
The issue was fixed by adding a call to `dispose()`.
However, if the object is protected from double disposal,
this can cause failures when running in debug mode
and `dispose()` is called elsewhere on the object.

## Migration guide

If you encounter the following error, update your code to call `dispose()' only in cases when your code created the object.

```
Once you have called dispose() on a <class name>, it can no longer be used.
```

Code before migration:

```dart
x.dispose();
```

Code after migration:

```dart
if (xIsCreatedByMe) {
x.dispose();
}
```

To locate the incorrect disposal, check the call stack of the error. If the call stack points to `dispose`
in your code, this disposal is incorrect and should be fixed.

If the error occurs in Flutter code, `dispose()` was
called incorrectly the first time.

You can locate the incorrect call by temporary calling `print(StackTrace.current)`
in the body of the failed method `dispose`.

## Timeline

See the progress and status [in the tracking issue](https://github.com/flutter/flutter/issues/134787).
2 changes: 2 additions & 0 deletions src/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ release, and listed in alphabetical order:

### Released in Flutter 3.13

* [Added missing `dispose()` for some disposable objects in Flutter][]
* [Deprecated API removed after v3.10][]
* [Added AppLifecycleState.hidden][] enum value
* [Moved ReorderableListView's localized strings][] from material to widgets localizations
Expand All @@ -60,6 +61,7 @@ release, and listed in alphabetical order:
* [Migrate a Windows project to ensure the window is shown][]
* [Updated `Checkbox.fillColor` behavior][]

[Added missing `dispose()` for some disposable objects in Flutter]: {{site.url}}/release/breaking-changes/dispose
[Deprecated API removed after v3.10]: {{site.url}}/release/breaking-changes/3-10-deprecations
[Added AppLifecycleState.hidden]: {{site.url}}/release/breaking-changes/add-applifecyclestate-hidden
[Moved ReorderableListView's localized strings]: {{site.url}}/release/breaking-changes/material-localized-strings
Expand Down

0 comments on commit 3ed02c4

Please sign in to comment.