mirror of
https://github.com/opencv/opencv.git
synced 2025-06-17 23:51:16 +08:00
fix leaking handle in cap_dshow.cpp
This commit is contained in:
parent
776c8c5c87
commit
d7240d1a28
@ -877,14 +877,12 @@ void videoDevice::NukeDownstream(IBaseFilter *pBF){
|
|||||||
|
|
||||||
void videoDevice::destroyGraph(){
|
void videoDevice::destroyGraph(){
|
||||||
HRESULT hr = 0;
|
HRESULT hr = 0;
|
||||||
//int FuncRetval=0;
|
|
||||||
//int NumFilters=0;
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (hr == NOERROR)
|
while (hr == NOERROR)
|
||||||
{
|
{
|
||||||
IEnumFilters * pEnum = 0;
|
IEnumFilters * pEnum = 0;
|
||||||
ULONG cFetched;
|
ULONG cFetched = 0;
|
||||||
|
|
||||||
// We must get the enumerator again every time because removing a filter from the graph
|
// We must get the enumerator again every time because removing a filter from the graph
|
||||||
// invalidates the enumerator. We always get only the first filter from each enumerator.
|
// invalidates the enumerator. We always get only the first filter from each enumerator.
|
||||||
@ -917,9 +915,11 @@ void videoDevice::destroyGraph(){
|
|||||||
pFilter->Release();
|
pFilter->Release();
|
||||||
pFilter = NULL;
|
pFilter = NULL;
|
||||||
}
|
}
|
||||||
else break;
|
|
||||||
pEnum->Release();
|
pEnum->Release();
|
||||||
pEnum = NULL;
|
pEnum = NULL;
|
||||||
|
|
||||||
|
if (cFetched == 0)
|
||||||
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user