Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions aravisApp/src/ADAravis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class ADAravis : public ADGenICam, epicsThreadRunable {

/** Used by epicsAtExit */
ArvCamera *camera;
ArvStream *stream;

/** Used by connection lost callback */
int connectionValid;
Expand Down Expand Up @@ -196,7 +197,6 @@ class ADAravis : public ADGenICam, epicsThreadRunable {
asynStatus makeCameraObject();
asynStatus makeStreamObject();

ArvStream *stream;
ArvDevice *device;
ArvGc *genicam;
char *cameraName;
Expand All @@ -221,13 +221,14 @@ GenICamFeature *ADAravis::createFeature(GenICamFeatureSet *set,
static void aravisShutdown(void* arg) {
ADAravis *pPvt = (ADAravis *) arg;
GErrorHelper err;
ArvCamera *cam = pPvt->camera;

printf("ADAravis: Stopping %s... ", pPvt->portName);
arv_camera_stop_acquisition(cam, err.get());
arv_camera_stop_acquisition(pPvt->camera, err.get());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a general note, passing the error parameter without checking if it NULL first can lead to errors from the Aravis library. I need to check how this is handled elsewhere, but without that, it feels like there's maybe something missing

pPvt->connectionValid = 0;
epicsThreadSleep(0.1);
pPvt->camera = NULL;
g_object_unref(cam);
arv_stream_set_emit_signals (pPvt->stream, FALSE);
g_clear_object(&pPvt->stream);
g_clear_object(&pPvt->camera);
printf("ADAravis: OK\n");
}

Expand Down Expand Up @@ -313,8 +314,8 @@ ADAravis::ADAravis(const char *portName, const char *cameraName, int enableCachi

: ADGenICam(portName, maxMemory, priority, stackSize),
camera(NULL),
connectionValid(0),
stream(NULL),
connectionValid(0),
device(NULL),
genicam(NULL),
payload(0),
Expand Down Expand Up @@ -526,6 +527,9 @@ asynStatus ADAravis::connectToCamera() {
/* Tell areaDetector it is no longer acquiring */
setIntegerParam(ADAcquire, 0);

/* update device list */
arv_update_device_list();

/* make the camera object */
status = this->makeCameraObject();
if (status) return status;
Expand Down