OF crashing when compiling more than once

Hi,

I have written an openFrameworks application in Xcode which communicates with an Arduino Nano board using ofArduino.cpp.

When I first start up my computer, then the first time I compile the code it works fine, and the application runs and can be closed as expected. However, if I then compile/launch the app again, the whole system crashes and I have to turn the computer off by holding down the power button.

When this happens, it SOMETIMES flashes up with this error:
GBD: Program received signal: “EXC_BAD_ACCESS”

But this is not consistent, and appears in a different place each time (sometimes in the ofArduino.cpp file, sometimes in the ofTrueTypeFont code…)

I’m totally stuck… any help much appreciated!

The same error for me with different arduino boards.

Actually i’m receiving.

Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
warning: Could not find object file “/Users/theo/Documents/CODE/__OPENFRAMEWORKS/SANDBOX/COMPILE_LIBRARIES/buildGlutFramework/libForeground.a(macx_foreground.o)” - no debug information available for “/Users/mcast/Code/GLUT-ToPost/macx_foreground.m”.

warning: Could not find object file “/Developer/usr/lib/gcc/i686-apple-darwin9/4.0.1/libgcc.a(_eprintf.o)” - no debug information available for “/var/tmp/gcc/gcc-5493~1/src/gcc/libgcc2.c”.

And Xcode is pointing to line 453 of ofArduino and processSysExData method.

Any help?

Thanks

I have the same problem “EXC_BAD_ACCESS” on line 506 of ofArduino.cpp. I’m using of 0.8.1. on Yosemite.
Any idea?
It appears 8 times on 10, when i run my app.

can you post your code?

Hi Zach, the code is from the example “firmataExample”. I just changed the string of my serial port. Sometimes works, sometimes not.
But here you can find the code of my project and there is the same problem:

void ofApp::setup(){
  ofSetVerticalSync(true);
  ofSetFrameRate(60);
  ofBackground(0);
  ofEnableAlphaBlending();
  ofSetCircleResolution(100);
  ard.connect("/dev/tty.usbmodemfd141", 57600);
  ofAddListener(ard.EInitialized, this, &ofApp::setupArduino);
  bSetupArduino	= false;
}

void ofApp::update()
{
  updateArduino();
}


void ofApp::setStations(int pinMin, int pinMax)
{
  for(int pin = pinMax; pin <= pinMax; pin++)
  {
    setStation(pin);
  }
}

void ofApp::setStations(int totStations)
{
  for(int pin = 0; pin < totStations; pin++)
  {
    setStation(pin);
  }
}

void ofApp::setStation(int pin)
{
  ard.sendAnalogPinReporting(pin, ARD_ANALOG);
}

int ofApp::getTotStations()
{
  return stationsValues.size();
}

//--------------------------------------------------------------
void ofApp::setupArduino(const int & version)
{
  ofRemoveListener(ard.EInitialized, this, &ofApp::setupArduino);
  bSetupArduino = true;
  ofLogNotice() << ard.getFirmwareName();
  ofLogNotice() << "firmata v" << ard.getMajorFirmwareVersion() << "." << ard.getMinorFirmwareVersion();
  setStation(5);
  ofAddListener(ard.EAnalogPinChanged, this, &ofApp::analogPinChanged);
}

void ofApp::updateArduino()
{
  ard.update();
  if (bSetupArduino)
  {
  }
}

void ofApp::analogPinChanged(const int & pinNum)
{
  cout << "analog pin: " + ofToString(pinNum) << " = " << ofToString(ard.getAnalog(pinNum)) << endl;
}


//--------------------------------------------------------------
void ofApp::draw()
{
  ofSetColor(255);
  if (!bSetupArduino)
  {
    cout << "arduino not ready..." << endl;
  }
  else
  {
  }
}

do you see any difference in what’s printed to the console ?

Now it crashed just one time on my project and zero on the example.
In che console i had the same output

[notice ] ofSerial: [0] = tty.usbmodemfd141
[notice ] ofSerial: [1] = cu.usbmodemfd141
[notice ] ofSerial: [2] = cu.Bluetooth-Modem
[notice ] ofSerial: [3] = tty.Bluetooth-Modem
[notice ] ofSerial: [4] = tty.Bluetooth-Incoming-Port
[notice ] ofSerial: [5] = cu.Bluetooth-Incoming-Port
[notice ] ofSerial: opening /dev/tty.usbmodemfd141 @ 57600 bps
[notice ] ofSerial: opened /dev/tty.usbmodemfd141 sucessfully @ 57600 bps
[notice ] StandardFirmata.ino
[notice ] firmata v2.3

and also this when it crashes

(lldb) 

Really don’t understand :-\