bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
637 stars 291 forks source link

[Bug] - Looking up a deactivated widget's ancestor is unsafe #931

Closed wer-mathurin closed 8 months ago

wer-mathurin commented 10 months ago

Steps to reproduce the bug

  1. Open a PlutoGrid in a Dialog
  2. Start editing a value
  3. Close the Dialog

Actual results

in the stack trace I found this

../packages/pluto_grid/src/manager/state/editing_state.dart 244:7 changeCellValue ../packages/pluto_grid/src/ui/cells/text_cell.dart 141:25 [_changeValue] ../packages/pluto_grid/src/ui/cells/text_cell.dart 77:7 dispose

Thsi is cause by

  void _changeValue() {
    if (formattedValue == _textController.text) {
      return;
    }
    =============> widget.stateManager.changeCellValue(widget.cell, _textController.text);  <=============

    _textController.text = formattedValue;

    _initialCellValue = _textController.text;

    _textController.selection = TextSelection.fromPosition(
      TextPosition(offset: _textController.text.length),
    );

    _cellEditingStatus = _CellEditingStatus.updated;
  }

Adding this check before the offending line resolve the issue

  if (!mounted) return;
github-actions[bot] commented 9 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.