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

D3D12MA_DEBUG_GLOBAL_MUTEX causes double lock on Release #29

Closed
Armageddonw opened this issue Dec 7, 2021 · 1 comment
Closed

D3D12MA_DEBUG_GLOBAL_MUTEX causes double lock on Release #29

Armageddonw opened this issue Dec 7, 2021 · 1 comment
Labels
bug Something isn't working next release To be done as soon as possible

Comments

@Armageddonw
Copy link

Defining D3D12MA_DEBUG_GLOBAL_MUTEX causes double locking of static debug std::mutex when releasing resources.

See IUnknownImpl::Release():

ULONG STDMETHODCALLTYPE IUnknownImpl::Release()
{
    D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK

    const uint32_t newRefCount = --m_RefCount;
    if(newRefCount == 0)
        ReleaseThis();
    return newRefCount;
}

When m_RefCount == 0, ReleaseThis(), tries to acquire debug lock again:

void Allocator::ReleaseThis()
{
    D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK
    ...
}

Resulting in std::system_exception being thrown.

@adam-sawicki-a adam-sawicki-a added bug Something isn't working next release To be done as soon as possible labels Dec 7, 2021
@adam-sawicki-a
Copy link
Collaborator

Thank you for finding this. It has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release To be done as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants