mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Fix for DataTable race-condition crash (#1962)
* Fix for DataTable race-condition crash * Update CHANGELOG.md
This commit is contained in:
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Fixed
|
||||
|
||||
- Fixed bug that prevented app pilot to press some keys https://github.com/Textualize/textual/issues/1815
|
||||
- DataTable race condition that caused crash https://github.com/Textualize/textual/pull/1962
|
||||
|
||||
## [0.13.0] - 2023-03-02
|
||||
|
||||
|
||||
@@ -1069,6 +1069,12 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
||||
console = self.app.console
|
||||
for row_key in new_rows:
|
||||
row_index = self._row_locations.get(row_key)
|
||||
|
||||
# The row could have been removed before on_idle was called, so we
|
||||
# need to be quite defensive here and don't assume that the row exists.
|
||||
if row_index is None:
|
||||
continue
|
||||
|
||||
row = self.rows.get(row_key)
|
||||
|
||||
if row.label is not None:
|
||||
@@ -1080,9 +1086,6 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
||||
self._label_column.content_width, label_content_width
|
||||
)
|
||||
|
||||
if row_index is None:
|
||||
continue
|
||||
|
||||
for column, renderable in zip(self.ordered_columns, cells_in_row):
|
||||
content_width = measure(console, renderable, 1)
|
||||
column.content_width = max(column.content_width, content_width)
|
||||
|
||||
Reference in New Issue
Block a user