Double lock in force_close()

Bug #1651422 reported by Daniel d'Andrada
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MirAL
Fix Released
High
Alan Griffiths

Bug Description

WindowManagementPolicy::forceClose() is causing miral mutex to be locked twice in the same thread.

in qtmir:

void WindowManagementPolicy::forceClose(const miral::Window &window)
{
    m_tools.invoke_under_lock([&window, this]() {
        m_tools.force_close(window);
    });
}

------------------

in miral:

void miral::BasicWindowManager::force_close(Window const& window)
{
    auto application = window.application();

    if (application && window)
        remove_surface(application, window);
}

void miral::BasicWindowManager::remove_surface(...)
{
    Locker lock{mutex, policy};
    [...]
}

void miral::BasicWindowManager::invoke_under_lock(std::function<void()> const& callback)
{
    Locker lock{mutex, policy};
    callback();
}

Related branches

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Yes, force_close() expects the mutex to be locked and so shouldn't be calling a function from shell::WindowManager (because that locks the mutex).

Changed in miral:
status: New → In Progress
assignee: nobody → Alan Griffiths (alan-griffiths)
importance: Undecided → High
Changed in miral:
status: In Progress → Fix Committed
Changed in miral:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.