Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/release-notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}}
run: |
FILES_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER/files)
echo "FILES_RESPONSE: $FILES_RESPONSE"
FILES_RESPONSE=$(gh api --paginate /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER/files)

HAS_CHANGED_RELEASE_NOTES=$(echo $FILES_RESPONSE | jq '.[].filename' | jq -s '. | any(. == env.CURRENT_RELEASE_FILE_PATH)')
HAS_CHANGED_RELEASE_NOTES=$(echo "$FILES_RESPONSE" | jq -r --arg path "$CURRENT_RELEASE_FILE_PATH" '[.[].filename == $path] | any')
echo "HAS_CHANGED_RELEASE_NOTES=$HAS_CHANGED_RELEASE_NOTES" >> $GITHUB_OUTPUT

- name: Check Release Preparedness requirements
Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ dart_code_metrics:
- avoid-explicit-type-declaration
# - ban-name # TODO(polina-c): add configuration
# - binary-expression-operand-order Some nice catches but too many false positives to enable.
- dispose-class-fields
- dispose-fields
- double-literal-format
# - format-comment TODO(jacobr): enable this one after fixing violations.
# TODO(jacobr): enable member-ordering. This catches a bunch of real style
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
FrameworkCore.dispose();
// Workaround for https://github.com/flutter/flutter/issues/155265.
removeTextFieldFocusFixHandler();
routerDelegate.dispose();
super.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class _EmbeddedExtensionState extends State<EmbeddedExtension>

@override
void dispose() {
_embeddedExtensionController.dispose();
iFrameController.dispose();
super.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ class _NotificationsState extends State<_Notifications> with AutoDisposeMixin {

@override
void dispose() {
_overlayEntry!.remove();
_overlayEntry
?..remove()
..dispose();
_overlayEntry = null;
super.dispose();
}

Expand Down Expand Up @@ -218,6 +221,7 @@ class _NotificationState extends State<_Notification>
void dispose() {
controller.dispose();
_dismissTimer?.cancel();
curve.dispose();
super.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class KeyboardShortcuts extends StatefulWidget {

class KeyboardShortcutsState extends State<KeyboardShortcuts>
with AutoDisposeMixin {
// ignore: dispose-fields, false positive. Disposed via autoDisposeFocusNode.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@incendial FYI several false positives in this PR when the object is disposed by another layer of abstraction.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've went though all the cases and I believe the vast majority is fixed (the only tricky one left is with applyToFeatureControllers). Fixes will be in 1.38.0 which ships today

late final FocusNode _focusNode;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class _AppSizeBodyState extends State<AppSizeBody>
);
static final tabs = [analysisTab, diffTab];

// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late AppSizeController controller;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@incendial is there also a way to detect when a class is not the owner of an object and therefore should not be responsible for disposing it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fixed as well


late final TabController _tabController;
Expand Down Expand Up @@ -390,6 +391,7 @@ class AnalysisView extends StatefulWidget {
}

class _AnalysisViewState extends State<AnalysisView> with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late AppSizeController controller;

TreemapNode? analysisRoot;
Expand Down Expand Up @@ -482,6 +484,7 @@ class DiffView extends StatefulWidget {
}

class _DiffViewState extends State<DiffView> with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late AppSizeController controller;

TreemapNode? diffRoot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class CallStack extends StatefulWidget {
class _CallStackState extends State<CallStack> {
StackFrameAndSourcePosition? _clickedOnFrame;

// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DebuggerController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DebuggingControls extends StatefulWidget {

class _DebuggingControlsState extends State<DebuggingControls>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DebuggerController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class DebuggerController extends DevToolsScreenController
_selectedBreakpoint.dispose();
_exceptionPauseMode.dispose();
_hasTruncatedFrames.dispose();
unawaited(_getStackOperation?.cancel());
_lastService = null;
super.dispose();
}

Expand Down Expand Up @@ -134,6 +136,7 @@ class DebuggerController extends DevToolsScreenController
_firstDebuggerScreenLoaded = false;
}

// ignore: dispose-class-fields, reference is nulled in dispose().
VmServiceWrapper? _lastService;

void _handleConnectionAvailable(VmServiceWrapper service) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class _DebuggerScreenBodyWrapper extends StatefulWidget {

class _DebuggerScreenBodyWrapperState extends State<_DebuggerScreenBodyWrapper>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DebuggerController controller;

late bool _shownFirstScript;
Expand Down Expand Up @@ -520,6 +521,7 @@ class _FloatingDebuggerControlsState extends State<FloatingDebuggerControls>
with AutoDisposeMixin {
bool get _isPaused => serviceConnection.serviceManager.isMainIsolatePaused;

// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late final DebuggerController _controller;
late double _controlHeight;
late double _controlOpacity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DeepLinkListView extends StatefulWidget {
}

class _DeepLinkListViewState extends State<DeepLinkListView> {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DeepLinksController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class DeepLinkPage extends StatefulWidget {
}

class _DeepLinkPageState extends State<DeepLinkPage> {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DeepLinksController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SelectProjectView extends StatefulWidget {
}

class _SelectProjectViewState extends State<SelectProjectView> {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late DeepLinksController controller;

bool _retrievingFlutterProject = false;
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app/lib/src/screens/dtd/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'shared.dart';
/// Manages business logic for the [EventsView] widget, which displays
/// information about events sent and received over DTD event streams.
class EventsController extends FeatureController {
// ignore: dispose-class-fields, this class is not the owner of this object.
late DartToolingDaemon dtd;

@visibleForTesting
Expand Down
1 change: 1 addition & 0 deletions packages/devtools_app/lib/src/screens/dtd/services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'dtd_tools_model.dart';
/// information about service methods registered on DTD and provides
/// functionality for calling them.
class ServicesController extends FeatureController {
// ignore: dispose-class-fields, this class is not the owner of this object.
late DartToolingDaemon dtd;

@visibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ class InspectorController extends DisposableController
/// for now mainly to minimize risk.
static const refreshFramesPerSecond = 5.0;

// ignore: dispose-class-fields, set from the constructor. This class is not the owner of this object.
InspectorTreeController inspectorTree;

final FlutterTreeType treeType;

late RateLimiter _refreshRateLimiter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,8 @@ class _InspectorTreeState extends State<InspectorTree>
Rect? _currentAnimateTarget;

AnimationController? _constraintDisplayController;

// ignore: dispose-fields, false positive. Disposed via autoDisposeFocusNode.
late FocusNode _focusNode;

/// When autoscrolling, the number of rows to pad the target location with.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ class FlexLayoutExplorerWidgetState
),
);
}

@override
void dispose() {
scrollController.dispose();
super.dispose();
}
}

class VisualizeFlexChildren extends StatefulWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ abstract class LayoutExplorerWidgetState<
entranceController.dispose();
changeController.dispose();
_unregisterInspectorControllerService();
entranceCurve.dispose();
changeAnimation.dispose();
rateLimiter.dispose();
super.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class _LogDetailsState extends State<LogDetails>
unawaited(_computeLogDetails());
}

@override
void dispose() {
scrollController.dispose();
super.dispose();
}

@override
void didUpdateWidget(LogDetails oldWidget) {
super.didUpdateWidget(oldWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class LoggingScreenBody extends StatefulWidget {

class _LoggingScreenState extends State<LoggingScreenBody>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late LoggingController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ConnectedMemoryBody extends StatefulWidget {

class _ConnectedMemoryBodyState extends State<ConnectedMemoryBody>
with AutoDisposeMixin, SingleTickerProviderStateMixin {
// ignore: dispose-fields, false positive. Disposed via autoDisposeFocusNode.
final _focusNode = FocusNode(debugLabel: 'memory');

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class _ClassFilterDialogState extends State<ClassFilterDialog> {
_loadStateFromFilter(widget.classFilter);
}

@override
void dispose() {
_except.dispose();
_only.dispose();
super.dispose();
}

@override
void didUpdateWidget(covariant ClassFilterDialog oldWidget) {
super.didUpdateWidget(oldWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class NetworkController extends DevToolsScreenController
@override
final screenId = ScreenMetaData.network.id;

// ignore: dispose-class-fields, false positive. List items are disposed in the dispose method.
List<DartIOHttpRequestData>? _httpRequests;

Future<String?> exportAsHarFile() async {
Expand Down Expand Up @@ -203,6 +204,10 @@ class NetworkController extends DevToolsScreenController
selectedRequest.dispose();
_recordingNotifier.dispose();
_currentNetworkRequests.dispose();
for (final r in _httpRequests ?? <DartIOHttpRequestData>[]) {
r.dispose();
}
_httpRequests?.clear();
super.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class NetworkScreenBody extends StatefulWidget {

class _NetworkScreenBodyState extends State<NetworkScreenBody>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late NetworkController controller;

@override
Expand Down Expand Up @@ -180,6 +181,7 @@ class _NetworkProfilerControls extends StatefulWidget {

class _NetworkProfilerControlsState extends State<_NetworkProfilerControls>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late NetworkController controller;

bool _recording = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class PerfettoControllerImpl extends PerfettoController {
await perfettoPostEventStream.close();
processor.dispose();
_activeScrollToTimeRange.dispose();
activeTrace.dispose();
super.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Perfetto extends StatefulWidget {
}

class _PerfettoState extends State<Perfetto> with AutoDisposeMixin {
late final PerfettoControllerImpl _perfettoController;
PerfettoControllerImpl get _perfettoController =>
widget.perfettoController as PerfettoControllerImpl;

late final _PerfettoViewController _viewController;

@override
void initState() {
super.initState();
_perfettoController = widget.perfettoController as PerfettoControllerImpl;
_viewController = _PerfettoViewController(_perfettoController)..init();

// If [_perfettoController.activeTrace.trace] has a null value, the trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ class PerformanceController extends DevToolsScreenController
@override
final screenId = ScreenMetaData.performance.id;

// ignore: dispose-class-fields, false positive. See `applyToFeatureControllers` in the dispose() method.
late final FlutterFramesController flutterFramesController;

// ignore: dispose-class-fields, false positive. See `applyToFeatureControllers` in the dispose() method.
late final TimelineEventsController timelineEventsController;

// ignore: dispose-class-fields, false positive. See `applyToFeatureControllers` in the dispose() method.
late final RebuildStatsController rebuildStatsController;

// ignore: dispose-class-fields, false positive. See `applyToFeatureControllers` in the dispose() method.
late List<PerformanceFeatureController> _featureControllers;

// TODO(jacobr): add the recount controller to [_featureControllers] once your
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class PerformanceScreenBody extends StatefulWidget {

class PerformanceScreenBodyState extends State<PerformanceScreenBody>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late PerformanceController controller;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import '../../shared/globals.dart';
import '../../shared/ui/common_widgets.dart';
import '../../shared/ui/tab.dart';
import 'panes/flutter_frames/flutter_frame_model.dart';
import 'panes/flutter_frames/flutter_frames_controller.dart';
import 'panes/frame_analysis/frame_analysis.dart';
import 'panes/rebuild_stats/rebuild_stats.dart';
import 'panes/timeline_events/timeline_events_view.dart';
Expand All @@ -30,22 +29,21 @@ class _TabbedPerformanceViewState extends State<TabbedPerformanceView>
with AutoDisposeMixin {
static const _gaPrefix = 'performanceTab';

// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late PerformanceController controller;

late FlutterFramesController _flutterFramesController;

FlutterFrame? _selectedFlutterFrame;

@override
void initState() {
super.initState();
controller = screenControllers.lookup<PerformanceController>();
_flutterFramesController = controller.flutterFramesController;
final flutterFramesController = controller.flutterFramesController;

_selectedFlutterFrame = _flutterFramesController.selectedFrame.value;
addAutoDisposeListener(_flutterFramesController.selectedFrame, () {
_selectedFlutterFrame = flutterFramesController.selectedFrame.value;
addAutoDisposeListener(flutterFramesController.selectedFrame, () {
setState(() {
_selectedFlutterFrame = _flutterFramesController.selectedFrame.value;
_selectedFlutterFrame = flutterFramesController.selectedFrame.value;
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ProfilerScreenBody extends StatefulWidget {

class _ProfilerScreenBodyState extends State<ProfilerScreenBody>
with AutoDisposeMixin {
// ignore: dispose-fields, screen controller disposal is handled by the [ScreenControllers] class.
late ProfilerScreenController controller;

bool recording = false;
Expand Down
Loading
Loading