diff --git a/glxbackend.cpp b/glxbackend.cpp index c59c647b1a..32fea4dd62 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -141,6 +141,9 @@ GlxBackend::~GlxBackend() if (window) XDestroyWindow(display(), window); + qDeleteAll(m_fbconfigHash); + m_fbconfigHash.clear(); + overlayWindow()->destroy(); delete m_overlayWindow; } @@ -446,12 +449,13 @@ int GlxBackend::visualDepth(xcb_visualid_t visual) const FBConfigInfo *GlxBackend::infoForVisual(xcb_visualid_t visual) { - FBConfigInfo *&info = m_fbconfigHash[visual]; + auto it = m_fbconfigHash.constFind(visual); + if (it != m_fbconfigHash.constEnd()) { + return it.value(); + } - if (info) - return info; - - info = new FBConfigInfo; + FBConfigInfo *info = new FBConfigInfo; + m_fbconfigHash.insert(visual, info); info->fbconfig = nullptr; info->bind_texture_format = 0; info->texture_targets = 0;