Odd crash in addCentredArc


#1

Odd crash. Anyone else ever seen this.

The code that calls it is completely straightforward, we create a Path on the stack and then add our centred arc.

We’ve had two different Logic X users report this with a beta and no-one else. I wonder if it’s a complier cock up even :slight_smile: but I’m going to go and check my work once again in case i’m missing something.

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)

Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000000185d95000

Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10

Termination Reason:    Namespace SIGNAL, Code 0xa

Terminating Process:   exc handler [0]

VM Regions Near 0x185d95000:

    MALLOC_LARGE           0000000185d32000-0000000185d5d000 [  172K] rw-/rwx SM=PRV  

--> mapped file            0000000185d95000-0000000185d96000 [    4K] r--/rwx SM=COW  

    Image IO               0000000185d96000-0000000185dd4000 [  248K] rw-/rwx SM=PRV  

Application Specific Information:

MALondonII | 94d3b910e514cb711d268bc5d953046c3bb629e70a5564a403b3bde53d2a75b7 | 9419a47d1e9fd89d618dfcd530b15af7c1e6c250 | 2018-09-24_08:40:21

 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0   com.deviousmachines.texture    0x00000001caff6bc1 void juce::Array<float, juce::DummyCriticalSection, 0>::add<float, float>(float const&, float, float) + 177

1   com.deviousmachines.texture    0x00000001cafce95f juce::Path::addCentredArc(float, float, float, float, float, float, float, bool) + 655

2   com.deviousmachines.texture    0x00000001cae921e9 ui::IgorKnobLookAndFeel::drawRotarySlider(juce::Graphics&, int, int, int, int, float, float, float, juce::Slider&) + 873

3   com.deviousmachines.texture    0x00000001cb090878 juce::Slider::paint(juce::Graphics&) + 232

4   com.deviousmachines.texture    0x00000001cb03f1c0 juce::Component::paintComponentAndChildren(juce::Graphics&) + 160

5   com.deviousmachines.texture    0x00000001cb03f633 juce::Component::paintComponentAndChildren(juce::Graphics&) + 1299

#2

Odd indeed! The Path and its array are on the stack so there can’t be any dangling pointers involved… Looking at addCentredArc, it doesn’t do anything funny, it just makes calls to lineTo(), which have been inlined. My only possible idea is that maybe it’s being fed crazy input values and one of the while loops is trying to add billions of points until something blows up?


#3

That’s the reasoning we went through too.

It’s in a slider callback, and I think slider will prevent it being fed crazy values (I did wonder about infinite radians at one point!)

        Path backgroundArc;
        backgroundArc.addCentredArc (bounds.getCentreX(), bounds.getCentreY(),
            arcRadius, arcRadius,
            0.0f,
            rotaryStartAngle, rotaryEndAngle,
            true);

        g.setColour (outline);
        g.strokePath (backgroundArc, PathStrokeType (lineWidth, PathStrokeType::curved, PathStrokeType::rounded));

#4

Well sorry, I’m stumped! But am interested to know more - please post if you find any more clues!


#5

I’m going to build the thing from clean and push that to the beta testers and hope it doesn’t recur :slight_smile:

I’ll do something to display an error if crazy values end up in our LookandFeel method too just in case there’s some way of sneaking nonsense past Slider :slight_smile: