• jam's avatar
    Ensure that NativeViewport destructs correctly on Linux. · 6345ee9d
    jam authored
    First, PlatformEventSource is a singleton so it shouldn't be created by PlatformViewportX11. Once we have multiple windows, this will be very clear. Until then, we also have UAFs on destruction of PlatformViewportX11 because PlatformEventSource could be lower in the stack calling a PlatformViewportX11 method which cause both of these objects to be deleted.
    
    Second, ensure that child windows of the PlatformViewport aren't used after the parent window is destructed, otherwise we get X errors. This is done by ensuring that NativeViewportImpl, which owns the PlatformViewport, destructs OnscreenContextProvider first. OnscreenContextProvider will in turn destroy all windows in the CommandBufferDriver that it created.
    
    Lastly, make NativeViewportImpl destroy itself when its platform window is closed (i.e. because the user closed the window). The old implementation in that method didn't do anything.
    
    This is split off https://codereview.chromium.org/1139673003
    
    BUG=484234
    
    Review URL: https://codereview.chromium.org/1130353008
    
    Cr-Commit-Position: refs/heads/master@{#330394}
    6345ee9d
command_buffer_driver.cc 8.76 KB