Skip to content

Commit 319e837

Browse files
committed
add: インスタンス破棄時にカメラを確実に閉じるためのデストラクタを追加
1 parent 1972340 commit 319e837

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

modules/CameraCapture/CameraCapture.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ CameraCapture::CameraCapture()
1313
{
1414
}
1515

16+
CameraCapture::~CameraCapture()
17+
{
18+
if(cap.isOpened()) {
19+
cap.release();
20+
}
21+
}
22+
1623
int CameraCapture::findAvailableCameraID(int maxTested)
1724
{
1825
for(int i = 0; i < maxTested; ++i) {

modules/CameraCapture/CameraCapture.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
class CameraCapture {
1818
public:
1919
CameraCapture();
20+
~CameraCapture();
2021

2122
/**
2223
* @brief 利用可能なカメラIDを探索する

0 commit comments

Comments
 (0)