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 @@ -14910,7 +14910,19 @@ protected virtual void OnDataSourceChanged(EventArgs e)
/// <summary>
/// Refresh items when the DataSource is disposed.
/// </summary>
private void OnDataSourceDisposed(object? sender, EventArgs e) => DataSource = null;
private void OnDataSourceDisposed(object? sender, EventArgs e)
{
try
{
_dataGridViewOper[OperationInReleasingDataSource] = true;
DataSource = null;
CurrentCell = null;
}
finally
{
_dataGridViewOper[OperationInReleasingDataSource] = false;
}
}

protected virtual void OnDefaultCellStyleChanged(EventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1922,17 +1922,6 @@ public object? DataSource
newDataSource.Disposed += OnDataSourceDisposed;
}

_dataGridViewOper[OperationInReleasingDataSource] = true;

try
{
CurrentCell = null;
}
finally
{
_dataGridViewOper[OperationInReleasingDataSource] = false;
}

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