Multiple ofVideoGrabbers crash on exit

I get a nasty SIGABRT / CAException when exiting my ofApp which uses two ofVideoGrabbers on two different devices: the FaceTime camera and an external USB webcam.

A single ofVideoGrabber works fine. Am I doing something wrong? Am I forgetting some kind of manual destruction/closing?

This is the stack trace

Could be a bug - this is the way I typically troubleshoot it

  1. Switch to pointers so you can control the deletion

    ofVideoGrabber* videoGrabber1;
    videoGrabber1 = new ofVideoGrabber();

  2. Use ofApp::exit() and delete yourself on exit

in ofApp.h

void exit();

in ofApp.cpp

void ofApp::exit()
    delete videoGrabber1;

Same thing still, an error in the ofQTKitGrabber somewhere.

Peculiarly, it is destructing the first webcam that crashes.

I was getting the same error. Turns out this was related to the fact that I was init-ing my videograbber to a non-native size.

I was using:

webcam2.initGrabber(320, 240);  //for testing purporses

However, the native resolution of my webcam is 1920x1080. When I changed it to:

webcam2.initGrabber(1920, 1080);

I no longer got the error.