From 866f8eb1e7c61b50336a33bea84244f00c2e6d8f Mon Sep 17 00:00:00 2001 From: Arek Date: Mon, 21 Nov 2016 02:22:43 +0100 Subject: [PATCH] Merge pull request #7695 from ArkadiuszRaj:aravis-release-bug-fix * Aravis: fixing releasing object when no communication with camera is possible * Removing unnecessary include --- modules/videoio/src/cap_aravis.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/videoio/src/cap_aravis.cpp b/modules/videoio/src/cap_aravis.cpp index 3423ca6..c272bee 100644 --- a/modules/videoio/src/cap_aravis.cpp +++ b/modules/videoio/src/cap_aravis.cpp @@ -188,11 +188,12 @@ CvCaptureCAM_Aravis::CvCaptureCAM_Aravis() void CvCaptureCAM_Aravis::close() { - if(camera) + if(camera) { stopCapture(); - g_object_unref(camera); - camera = NULL; + g_object_unref(camera); + camera = NULL; + } } bool CvCaptureCAM_Aravis::getDeviceNameById(int id, std::string &device) @@ -559,8 +560,10 @@ void CvCaptureCAM_Aravis::stopCapture() { arv_camera_stop_acquisition(camera); - g_object_unref(stream); - stream = NULL; + if(stream) { + g_object_unref(stream); + stream = NULL; + } } bool CvCaptureCAM_Aravis::startCapture() -- 2.7.4