Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

COM reference leak?

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

Nobody has claimed this yet.

Assessment

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

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.

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());
Dominant language
C#
Stars
261
Forks
81
Avg merge
1m
Merged PRs (30d)
1

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

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.

More from microsoft/Windows-Camera

All issues in microsoft/Windows-Camera

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.