Skip to content

Commit c6919fe

Browse files
zansbangcolin
and
colin
authored
修复过快关闭窗口导致程序闪退的Bug (#1027)
* 修复过快关闭窗口导致程序闪退的Bug --------- Co-authored-by: colin <zansbang@gmail.com>
1 parent 5dda00c commit c6919fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Desktop/BiliCopilot.UI/Controls/Core/Player/IslandPlayer.Win32.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ public void MoveAndResize(
154154
int width,
155155
int height)
156156
{
157-
_desktopWindowXamlSource?.SiteBridge?.MoveAndResize(new Windows.Graphics.RectInt32(0, 0, width, height));
157+
// 判断窗口是否被销毁,如果销毁了就不重置位置
158+
// 之前没有判断直接重置窗口位置会导致程序闪退
159+
if (_desktopWindowXamlSource != null && _desktopWindowXamlSource.SiteBridge != null && !_desktopWindowXamlSource.SiteBridge.IsClosed)
160+
{
161+
_desktopWindowXamlSource.SiteBridge.MoveAndResize(new Windows.Graphics.RectInt32(0, 0, width, height));
162+
}
158163
}
159164

160165
/// <summary>

0 commit comments

Comments
 (0)