RĂ©mi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
70655272 by Pierre Lamot at 2022-06-19T16:53:13+00:00
qt: fix crash on X11 while quitting

this seems to happen in some case where graphical effects are used (drop shadow
on the audio cover in the full player for instance)

- - - - -


1 changed file:

- modules/gui/qt/maininterface/compositor_x11_uisurface.cpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
=====================================
@@ -20,6 +20,7 @@
 #include <QQmlEngine>
 #include <QQuickWindow>
 #include <QQuickItem>
+#include <QOffscreenSurface>
 
 #include "compositor_x11_uisurface.hpp"
 
@@ -66,16 +67,31 @@ CompositorX11UISurface::CompositorX11UISurface(QWindow* 
window, QScreen* screen)
 
 CompositorX11UISurface::~CompositorX11UISurface()
 {
+    auto surface = new QOffscreenSurface();
+    surface->setFormat(m_context->format());
+    surface->create();
+
+    // Make sure the context is current while doing cleanup. Note that we use 
the
+    // offscreen surface here because passing 'this' at this point is not 
safe: the
+    // underlying platform window may already be destroyed. To avoid all the 
trouble, use
+    // another surface that is valid for sure.
+    m_context->makeCurrent(surface);
+
     if (m_rootItem)
         delete m_rootItem;
-    if (m_uiWindow)
-        delete m_uiWindow;
     if (m_uiRenderControl)
         delete m_uiRenderControl;
-    if (m_context)
-        delete m_context;
+    if (m_uiWindow)
+        delete m_uiWindow;
     if (m_qmlEngine)
         delete m_qmlEngine;
+
+    m_context->doneCurrent();
+
+    delete surface;
+    if (m_context)
+        delete m_context;
+
 }
 
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/70655272927e57f41f261f03533c9935a4a1aa4f

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/70655272927e57f41f261f03533c9935a4a1aa4f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to