Skip to content
  • Vlad Zahorodnii's avatar
    wayland: Fix internal connection teardown · 617291c6
    Vlad Zahorodnii authored
    The internal EventQueue is a child of the registry object. This means
    that after the registry is destroyed, all proxy objects in that event
    queue are going to have invalid reference to it, which is not a problem
    as long as the wl_display_dispatch() function is not called.
    
    The wl_display_dispatch() function uses wl_proxy's queue reference to
    enqueue incoming events to that queue.
    
    Unfortunately, during teardown, the internal ConnectionThread may
    dispatch events right after the registry object has been destroyed,
    which can lead to a crash.
    
    In order to fix the crash, we need to destroy all proxy objects and only
    after that we can destroy the event queue. It's okay if wayland events
    are dispatched in between.
    
    
    (cherry picked from commit 33b2ea20)
    617291c6
Loading