fix(dock): add drag payload validation and ensure unconditional state cleanup

This commit is contained in:
2026-03-28 16:47:08 +09:00
parent e80266f2bc
commit 5ceb7c11ed

View File

@@ -386,7 +386,8 @@ public sealed partial class DockLayout : Control
{ {
if (_dropTargetOverlay != null) _dropTargetOverlay.Visibility = Visibility.Collapsed; if (_dropTargetOverlay != null) _dropTargetOverlay.Visibility = Visibility.Collapsed;
if (_draggedItem == null || _sourceNode == null || !(sender is FrameworkElement targetElement) || !(targetElement.Tag is DockPanelNode targetNode)) if (!e.DataView.Properties.ContainsKey(DRAG_PROPERTY_DOCK_TAB) ||
_draggedItem == null || _sourceNode == null || !(sender is FrameworkElement targetElement) || !(targetElement.Tag is DockPanelNode targetNode))
{ {
ClearDragOperationState(); ClearDragOperationState();
return; return;
@@ -420,6 +421,8 @@ public sealed partial class DockLayout : Control
} }
private void TabView_TabDroppedOutside(Microsoft.UI.Xaml.Controls.TabView sender, Microsoft.UI.Xaml.Controls.TabViewTabDroppedOutsideEventArgs args) private void TabView_TabDroppedOutside(Microsoft.UI.Xaml.Controls.TabView sender, Microsoft.UI.Xaml.Controls.TabViewTabDroppedOutsideEventArgs args)
{
try
{ {
if (_sourceNode != null && _draggedItem != null) if (_sourceNode != null && _draggedItem != null)
{ {
@@ -433,7 +436,10 @@ public sealed partial class DockLayout : Control
{ {
Logger.LogWarning($"Tab tear-off failed: {result.Message}"); Logger.LogWarning($"Tab tear-off failed: {result.Message}");
} }
}
}
finally
{
ClearDragOperationState(); ClearDragOperationState();
} }
} }