• Rémi Bernon's avatar
    server: Track desktop users per thread instead of per process. · 769a2616
    Rémi Bernon authored
    As some thread may use a different desktop from their process.
    
    This fixes the user32 win tests, which leaks a desktop that never gets
    closed. The test_shell_window test creates a new desktop, which spawns
    explorer.exe process, incrementing the desktop user count to 1, then
    associates the desktop to a thread, which closes it on exit.
    
    Never the user count is incremented to 2, and closing the thread desktop
    doesn't either check whether the desktop process should be terminated.
    
    Reversely, it is possible to create a desktop, associate it with a
    thread /and/ a process, and this time the desktop process would be
    terminated when the process exits, although the thread may still be
    using it.
    
    Tracking the users per thread is more robust and fixes the problem as
    set_thread_desktop increments the desktop user count, and thread exit
    decrements it.
    Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    769a2616
user.h 11.7 KB