Fix crash when cycling through disks quickly (JB-9)
Matthias Schaffer opened 4 weeks ago

When users cycle through disks really fast, the application crashes with a NullReferenceException in Avalonia.Media.Imaging.Bitmap.get_Size() during layout.

Root Cause: The bitmap property was being set to null before loading the new bitmap, causing the UI to access Bitmap.Size on a null object during layout passes.

Solution:

  • Modified bitmap loading in ViewModels to load new bitmap before disposing old one
  • Added IsNotNullConverter to safely handle null bitmaps in UI
  • Added IsVisible bindings to Image controls to hide them when bitmap is null

Files Changed:

  • DiskTitleViewModel.cs - Fixed race condition in UpdateCover()
  • NowPlayingViewModel.cs - Fixed race condition in UpdateCover()
  • SlideshowViewModel.cs - Fixed race condition in Advance()
  • IsNotNullConverter.cs - New converter for null checks
  • DiskTitleView.axaml - Added null-safety binding
  • NowPlayingView.axaml - Added null-safety binding
  • SlideshowView.axaml - Added null-safety binding
  • Matthias Schaffer commented 4 weeks ago

    Branch created: fix/disk-cycling-crash

    Changes committed locally. The branch needs to be pushed to the remote repository. Once pushed, a pull request will be created.

    Commit: 61c13bf - Fix crash when cycling through disks quickly

  • OneDev commented 4 weeks ago

    State changed as pull request JB-12 is open

  • OneDev changed state to 'In Review' 4 weeks ago
    Previous Value Current Value
    Open
    In Review
  • Matthias Schaffer commented 4 weeks ago

    Pull request created: JB-12

    https://onedev.schleckselbrot.de/Jukebox/~pulls/12

    The PR contains all the fixes for the crash when cycling through disks quickly.

  • OneDev commented 2 weeks ago

    State changed as code fixing the issue is committed (61c13bfe)

  • OneDev changed state to 'Closed' 2 weeks ago
    Previous Value Current Value
    In Review
    Closed
issue 1/1
Type
Bug
Priority
Major
Assignees
Not assigned
Issue Votes (0)
Watchers (1)
Reference
JB-9
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover