Skip to content
Snippets Groups Projects
Verified Commit 13a645a4 authored by Emilia's avatar Emilia
Browse files

Fix Docking UI and ScrollToEnd race condition crash

parent 94bce6cc
Branches
Tags v20
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<entry key="Blacklight/ErrorWindow.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/ErrorWindow.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/App.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/App.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/ClientView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/ClientView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/Dialogs/CreateChannelView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/Documents/DocumentView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/Documents/DocumentView.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/ErrorBoundary.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" /> <entry key="Blacklight/Views/ErrorBoundary.axaml" value="Blacklight.Desktop/Blacklight.Desktop.csproj" />
<entry key="Blacklight/Views/LoadingView.axaml" value="Blacklight/Blacklight.csproj" /> <entry key="Blacklight/Views/LoadingView.axaml" value="Blacklight/Blacklight.csproj" />
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
......
...@@ -28,13 +28,13 @@ public class ScrollToEndBehavior : Behavior<ScrollViewer> ...@@ -28,13 +28,13 @@ public class ScrollToEndBehavior : Behavior<ScrollViewer>
private void ScrollNow(bool shouldScroll) private void ScrollNow(bool shouldScroll)
{ {
Log.Information("I should scroll maybe? {ShouldScroll}, {Other}", shouldScroll, AssociatedObject != null); Log.Debug("I should scroll maybe? {ShouldScroll}, {Other}", shouldScroll, AssociatedObject != null);
if (shouldScroll && AssociatedObject != null)
{
Dispatcher.UIThread.Post(() => Dispatcher.UIThread.Post(() =>
{
if (shouldScroll && AssociatedObject != null)
{ {
AssociatedObject.ScrollToEnd(); AssociatedObject.ScrollToEnd();
});
} }
});
} }
} }
...@@ -44,6 +44,7 @@ public class ClientViewModel : ViewModelBase ...@@ -44,6 +44,7 @@ public class ClientViewModel : ViewModelBase
Client = client; Client = client;
DebugFactoryEvents(_factory); DebugFactoryEvents(_factory);
Layout = _factory?.CreateLayout();
if (Layout is { }) if (Layout is { })
{ {
_factory?.InitLayout(Layout); _factory?.InitLayout(Layout);
...@@ -52,7 +53,6 @@ public class ClientViewModel : ViewModelBase ...@@ -52,7 +53,6 @@ public class ClientViewModel : ViewModelBase
root.Navigate.Execute("Home"); root.Navigate.Execute("Home");
} }
} }
Layout = _factory?.CreateLayout();
NewLayout = new RelayCommand(ResetLayout); NewLayout = new RelayCommand(ResetLayout);
Logout = new RelayCommand(LogoutNow); Logout = new RelayCommand(LogoutNow);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="14.0.0" /> <PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="Avalonia" Version="11.2.5" /> <PackageReference Include="Avalonia" Version="11.1.3" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Lightquark.Types" Version="2024.9.15.139" /> <PackageReference Include="Lightquark.Types" Version="2024.9.15.139" />
<PackageReference Include="Markdig" Version="0.40.0" /> <PackageReference Include="Markdig" Version="0.40.0" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment