Post

Replies

Boosts

Views

Activity

Reply to Horrible weird Window Server killing bug
This got even weirder. One is that sometimes the use of cos() would cause a compiler error, which was fixed by using Darwin.cos(). This may be fixed in Swift 6.3. The other thing is that in my much more complex code, the crash seemed to be caused by both the cos() call evaluating to 0, but only when the line being drawn with that result had a StrokeStyle applied to it. In anycase, I have filed Feedbacks explaining this, and I'm told the WindowServer team has had it brought to their attention.
Topic: UI Frameworks SubTopic: SwiftUI
3d
Reply to Horrible weird Window Server killing bug
Urgh, I think it's a divide by zero bug. So this can apparently crash the Window server: Path { path in path.move(to: pt(qdt.qx * -20, 0)) // DIV BY ZERO path.addLine(to: pt(qdt.qx * -20, qdt.qy * (sH)/cos(angle.radians))) } If cos(angle.radians) is 0, you get a simple but unrecoverable divide by zero error, and hey, that's on me. But I would expect the system to kick my program with a nice "EDIVBYZERO", not take out the window server. My solution to this is this function, which works because I don't need perfect accuracy: func cosNZ(_ input: Double) -> Double { let x = cos(input) if x == 0.0 { return Double.leastNonzeroMagnitude } return x }
Topic: UI Frameworks SubTopic: SwiftUI
5d
Reply to help() view modifier
Ooops, forgot I wrote that modifier, here it is: extension View { func roundedBorder(style: StrokeStyle = StrokeStyle(lineWidth: 1.0), color: Color = Color(#colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1))) -> some View { modifier(RoundedBorder(strokeStyle: style, color: color)) } } This is for macOS, yep.
Topic: UI Frameworks SubTopic: SwiftUI
Dec ’25
Reply to "service is in penalty box"
I was just using the program. Mostly I want to know what being in a penalty box means. Obviously it's not urgent, in fact I haven't seen it any time lately, so maybe a macOS upgrade changed things. I found it when I was looking to understand what the plugin I was developing was doing.
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’24