Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] File is never closed #1537

Closed
2 tasks done
llfbandit opened this issue Jun 5, 2023 · 1 comment · Fixed by #1517
Closed
2 tasks done

[Windows] File is never closed #1537

llfbandit opened this issue Jun 5, 2023 · 1 comment · Fixed by #1517
Labels
bug platform-windows Affects the windows platform

Comments

@llfbandit
Copy link

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

When player has been disposed after playing a file, the input is still open.

Expected behaviour

File closed to not leak resources and be able to manipulate it.

Steps to reproduce

  1. play an input file.
  2. dispose the player.

Code sample

No response

Affected platforms

Windows

Platform details

Windows 11

AudioPlayers Version

4.1.0

Build mode

debug, release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) : Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. 

Related issues / more information

As far as I can tell regarding the code, the source is not released.
As IMFMediaSource is COM object, Release() should be called before setting the pointer to a null reference.

Maybe I'm wrong on the issue location:
https://github.com/bluefireteam/audioplayers/blob/92995357c4e29d63537d66f478dca8f655e99a08/packages/audioplayers_windows/windows/MediaEngineExtension.cpp#LL104C9-L104C25

For what it's worth I use those wrappers to release COM objects:

//////////////////////////////////////////////////////////////////////////
//  COM Safe release
//////////////////////////////////////////////////////////////////////////

template <class T> void SafeRelease(T** ppT)
{
	if (*ppT)
	{
		(*ppT)->Release();
		*ppT = NULL;
	}
}

template <class T> inline void SafeRelease(T*& pT)
{
	if (pT != NULL)
	{
		pT->Release();
		pT = NULL;
	}
}

Working on PR

no way

@llfbandit llfbandit added the bug label Jun 5, 2023
@Gustl22 Gustl22 added the platform-windows Affects the windows platform label Jun 12, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Jun 12, 2023

May needs to be fixed in #1517, to properly release the files.

Gustl22 added a commit that referenced this issue Aug 18, 2023
# Description

Release sources in `Release` mode, when source is `completed`.

## Related Issues

Closes #1537
Gustl22 added a commit that referenced this issue Sep 26, 2023
# Description

Release sources in `Release` mode, when source is `completed`.

## Related Issues

Closes #1537

(cherry picked from commit 09496dc)
Gustl22 added a commit that referenced this issue Nov 14, 2023
# Description

Release sources in `Release` mode, when source is `completed`.

## Related Issues

Closes #1537
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-windows Affects the windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants