microsoft / microsoft/Windows-Camera

COM reference leak?

Open
#58 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
261
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Hi,

Hi think there's a COM reference leak here
https://github.com/microsoft/Windows-Camera/blob/master/Samples/VirtualCamera/VirtualCameraMediaSource/SimpleMediaSource.cpp#L37

auto ptr = winrt::make_self<SimpleMediaStream>(); // +1
m_streamList[i] = ptr.detach(); // +2

It's caused by the mix between WIL and C++/WinRT

This could be fixed by something like this for example:

m_streamList[i].attach(ptr.detach());

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at VirtualCamera/VirtualCameraMediaSource/SimpleMediaSource.cpp line 37 and inspect how the C++/WinRT object is transferred into m_streamList[i]. Compare the WIL and C++/WinRT ownership at that point, then verify that the corrected ownership path no longer adds an unreleased COM reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.