Skip to content

Commit 673ca37

Browse files
authored
LT-22227: Fix crash when using "Duplicate Affix Slot"
This also fixes LT-21902 and LT-22095. Also tested LT-22096 to confirm that it didn’t regress.
1 parent 3207c4d commit 673ca37

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Src/Common/Controls/DetailControls/DataTree.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,16 @@ public bool DoNotRefresh
13991399
/// True to not recycle any slices.
14001400
/// False to try and recycle them.
14011401
/// </param>
1402+
/// <param name="restoreFocusSlice"> True to restore the focus slices.</param>
14021403
/// <remarks>
14031404
/// If the DataTree's slices call this method, they should use 'false',
14041405
/// or they will be disposed when this call returns to them.
1406+
/// Update 12/2025: Passing 'false' for 'differentObject' still appears to dispose
1407+
/// all the existing slices and create new ones. It does this when called from
1408+
/// Slice.MoveField() and possibly from other or all situations.
14051409
/// </remarks>
14061410
/// ------------------------------------------------------------------------------------
1407-
public virtual void RefreshList(bool differentObject)
1411+
public void RefreshList(bool differentObject, bool restoreFocusSlice = false)
14081412
{
14091413
CheckDisposed();
14101414
if (m_fDoNotRefresh)
@@ -1497,7 +1501,10 @@ public virtual void RefreshList(bool differentObject)
14971501
// Scrolling the control into view needs to be done after we resume the layout.
14981502
if (m_currentSlice != null)
14991503
{
1500-
m_currentSlice.TakeFocus(false);
1504+
if (restoreFocusSlice)
1505+
{
1506+
m_currentSlice.TakeFocus(false);
1507+
}
15011508
ScrollControlIntoView(m_currentSlice);
15021509
}
15031510

Src/Common/Controls/DetailControls/Slice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2853,7 +2853,7 @@ private void MoveField(Direction dir)
28532853
// Persist in the parent part (might not be the immediate parent node)
28542854
Inventory.GetInventory("layouts", m_cache.ProjectId.Name)
28552855
.PersistOverrideElement(PartParent(fieldRef));
2856-
ContainingDataTree.RefreshList(true);
2856+
ContainingDataTree.RefreshList(true, true);
28572857
}
28582858

28592859
/// <summary>

0 commit comments

Comments
 (0)