Having a weird crash that I can't track
2025-03-13 20:05:02.413709+01 by Dan Lyke 5 comments
Having a weird crash that I can't track down, so figured I'd let XCode do static analysis.
Wow is this... of questionable value.
2025-03-13 20:05:02.413709+01 by Dan Lyke 5 comments
Having a weird crash that I can't track down, so figured I'd let XCode do static analysis.
Wow is this... of questionable value.
comments in descending chronological order (reverse):
#Comment Re: Having a weird crash that I can't track made: 2025-03-14 00:08:00.774712+01 by: Dan Lyke
Yeah, it's weird because I believe that the way Objective-C does pointers is roughly the same as C++ weak and smart (non-intrusive) pointers, each pointer is part of a linked list, so that when the references from the strong pointers go to zero the weak pointers can be niled. So actual dangling pointers are hard to create.
It seems like the first undo record created by this particular path is the problem, but so far as I can tell, all of those undo records are created exactly the same. Maybe it's related to controls which might be undo targets going away...
#Comment Re: Having a weird crash that I can't track made: 2025-03-14 00:08:00.774712+01 by: markd
I'd double-check that what's passed in to the Dict<string, Number> is actually one of those (granted, the compiler should gripe if you tried to pass a Dict<string, Date> there...)
undo can be really fiddly. I don't know if it strongly captures everything - could be a case of nothing-but- weak causing the undoable object to vanish. Zombies would catch that case.
#Comment Re: Having a weird crash that I can't track made: 2025-03-14 00:08:00.774712+01 by: Dan Lyke
My particular crash is that when I add things to the undo stack from one path everything works fine, when I add what looks like the exact same thing to the undo stack from another path, the top thing on the undo stack crashes. Sometimes with different message send failures, sometimes with just EXC_BAD_ACCESS. Something's getting memory corrupted by the second path, but danged if I can find it.
So in the mean-time I figured I'd chase down some static analysis stuff, and there's the usual "didn't specify _Nullable in all the right places" bits, which whatever, but there's some things about typing and allegedly unused variables that dang, I am not seeing.
And why is it complaining that an argument declared as (NSMutableDictionary<nsstring *, NSNumber *> *)dict is a Conversion from value of type 'NSNumber *' to incompatible type 'NSDate *'" when I attempt to do dict[s] = @(0)? We'll never know...
#Comment Re: Having a weird crash that I can't track made: 2025-03-13 20:11:48.040152+01 by: markd
The three sanitizers (thread, address, and undefined behavior) can be useful. Not nearly as nice as Purify was back in the 90s, but can detect some classes of race conditions. zombies are good to catching unintentional object reuse. (less of a problem with ARC, but can still happen)
#Comment Re: Having a weird crash that I can't track made: 2025-03-13 20:11:48.040152+01 by: markd
static analysis used to be pretty good. It's probably bitrot the last decade.