Skip to content

StableBar crashes after a drop while editing the bar in place on two displays #636

Closed

Description

@M4n0x

What happens

On a Mac with two displays, StableBar quits while editing the bar in place. Dropping a widget on one display's edit bar makes the other display's edit bar abort the app a moment later (here 0.35 s after the drop).

Steps to reproduce

  1. Connect a second display, so each display has a bar.
  2. Choose Edit Bar in Place.
  3. Drag a widget to another position on one display's bar and drop it.

Expected

The widget moves, and both edit bars show it in its new place.

Environment

Evidence

The crash report's main thread, abridged:

__assert_rtn
NSCGSizeApplyInverseAffineTransform
-[NSView convertSizeFromBacking:]
NSHostingView.minSize()
NSHostingView.SizeConstraints.update(from:)
NSHostingView._willUpdateConstraintsForSubtree()
…
-[NSView layoutSubtreeIfNeeded]
-[NSView _setDefaultKeyViewLoop]
AppKitPlatformViewHost.viewDidMoveToSuperview()
-[NSView addSubview:positioned:relativeTo:]
_AppKitAddSubview
DisplayList.ViewUpdater.updateItemView(container:from:localState:)
…
NSHostingView.layout()

A test that edits the bar on two displays and drops a widget on the first aborts on current main with:

Assertion failed: (determinant != 0), function NSCGSizeApplyInverseAffineTransform, file NSView.m, line 6271.

Diagnosis

  • Sources/StableBar/BarEditView.swift:90 draws a unit the edit bar hasn't measured yet at .scaleEffect(0), so it grows in from nothing (added in feat: keep widgets in place while editing the bar and scroll a crowded side #635).
  • Each tile is a BarEditDragSource, an NSViewRepresentable whose view holds an NSHostingView (WidgetHostingView). When SwiftUI adds that view under a scale of 0, AppKit lays out the inner hosting view and inverts the scale to get its minimum size. A scale of 0 has no inverse, so AppKit aborts.
  • With two displays: while the widget is over the first display, BarEditing.arranged (Sources/StableBar/BarEditing.swift:181) leaves it out of the other display's edit bar, whose measuring copy then drops its width (widths = $0, BarEditView.swift:148). Once the move is saved, the widget comes back there unmeasured, at scale 0.
  • Any unit that appears unmeasured takes the same path, so adding a widget may crash too (not checked).
  • A standalone SwiftUI program with the same nesting aborts at a scale of 0 and runs at 0.01.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 13, 2026
  2. stablebar-releases commented on Nov 14, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.15.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  3. added a commit that references this issue on Nov 14, 2026
    78b073d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions