Skip to content
  • Vlad Zahorodnii's avatar
    kwineffects: Fix destruction of s_fbo with shared GLTexture objects · 1b1aef83
    Vlad Zahorodnii authored
    The WindowThumbnail item uses the GLTexture class. In order to destroy
    the thumbnail texture, the item will schedule a destroy job.
    
    This means that the GLTexture can be alive during or after graphics
    reset.
    
    On the other hand, as an implementation detail, GLTexture::clear() may
    allocate a framebuffer object, which is going to be destroyed together
    with the last texture.
    
    Given that window thumbnail textures can be still alive after a graphics
    reset and the fact that GLTexturePrivate::s_fbo gets destroyed when the
    last texture is destroyed, kwin can end up trying to clear a decoration
    texture with now defunct s_fbo.
    
    Since the old old s_fbo is inert, the glBindFramebuffer() function will
    fail and the glClear() operation will affect the default framebuffer,
    thus leading to black flickering visual artifacts.
    
    In order to fix that issue, this change makes GLTexture destroy s_fbo
    unconditionally in GLTexturePrivate::cleanup() which is called whenever
    OpenGL stuff is about to tear down, e.g. due to graphics reset, etc.
    
    BUG: 443951
    
    
    (cherry picked from commit fda7e150)
    1b1aef83