Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -27017,7 +27017,8 @@ protected virtual bool SetCurrentCellAddressCore(int columnIndex,
int oldCurrentCellY = _ptCurrentCell.Y;
if (oldCurrentCellX >= 0
&& !_dataGridViewState1[State1_TemporarilyResetCurrentCell]
&& !_dataGridViewOper[OperationInDispose])
&& !_dataGridViewOper[OperationInDispose]
&& !_isReleasingDataSource)
{
DataGridViewCell currentCell = CurrentCellInternal;
if (!EndEdit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ private const DataGridViewAutoSizeRowCriteriaInternal InvalidDataGridViewAutoSiz
private int _inBulkPaintCount;
private int _inBulkLayoutCount;
private int _inPerformLayoutCount;
private bool _isReleasingDataSource;

private int _keyboardResizeStep;
private Rectangle _resizeClipRectangle;
Expand Down Expand Up @@ -1921,7 +1922,17 @@ public object? DataSource
newDataSource.Disposed += OnDataSourceDisposed;
}

CurrentCell = null;
_isReleasingDataSource = true;

try
{
CurrentCell = null;
}
finally
{
_isReleasingDataSource = false;
}

if (DataConnection is null)
{
DataConnection = new DataGridViewDataConnection(this);
Expand Down
Loading