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

mf::WlShmBuffer::on_buffer_destroyed(wl_listener *listener, void *) is racy #355

Closed
AlanGriffiths opened this issue May 8, 2018 · 0 comments
Assignees
Labels

Comments

@AlanGriffiths
Copy link
Collaborator

        std::lock_guard <std::mutex> lock{*shim->mutex};
        if (auto mir_buffer = shim->associated_buffer.lock()) {
            mir_buffer->buffer = nullptr;
        }

This can lead to a deadlock. If at the end of the "if" scope mir_buffer is the last remaining owner of the buffer, then the destructor will be called. The destructor also tries to lock the mutex: crunch!

@AlanGriffiths AlanGriffiths self-assigned this May 8, 2018
bors bot added a commit that referenced this issue May 9, 2018
356: Don't hold a lock while potentially destroying an object that uses it. r=wmww a=AlanGriffiths

Don't hold a lock while potentially destroying an object that uses it. (Fixes #355)

Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
bors bot added a commit that referenced this issue May 9, 2018
356: Don't hold a lock while potentially destroying an object that uses it. r=wmww a=AlanGriffiths

Don't hold a lock while potentially destroying an object that uses it. (Fixes #355)

Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
bors bot added a commit that referenced this issue May 11, 2018
356: Don't hold a lock while potentially destroying an object that uses it. r=wmww a=AlanGriffiths

Don't hold a lock while potentially destroying an object that uses it. (Fixes #355)

Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
@bors bors bot closed this as completed in #356 May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant