[vlc-commits] [Git][videolan/vlc][master] qt: fix memory leak in X11 compositor

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Nov 18 11:41:16 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
91318e58 by Pierre Lamot at 2021-11-18T11:21:14+00:00
qt: fix memory leak in X11 compositor

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
=====================================
@@ -344,8 +344,6 @@ CompositorX11RenderWindow::CompositorX11RenderWindow(qt_intf_t* p_intf, xcb_conn
 
     m_window = m_rootWidget->window()->windowHandle();
     m_wid = m_window->winId();
-
-    m_damageObserver = new X11DamageObserver(m_intf, m_conn);
 }
 
 CompositorX11RenderWindow::~CompositorX11RenderWindow()
@@ -364,9 +362,12 @@ CompositorX11RenderWindow::~CompositorX11RenderWindow()
 
 bool CompositorX11RenderWindow::init()
 {
+    m_damageObserver = new X11DamageObserver(m_intf, m_conn);
     bool ret = m_damageObserver->init();
     if (!ret)
     {
+        delete m_damageObserver;
+        m_damageObserver = nullptr;
         msg_Warn(m_intf, "can't initialize X11 damage");
         return false;
     }
@@ -422,6 +423,7 @@ bool CompositorX11RenderWindow::startRendering()
     connect(m_renderThread, &QThread::started, m_damageObserver, &X11DamageObserver::start);
     connect(this, &CompositorX11RenderWindow::registerVideoWindow, m_damageObserver,  &X11DamageObserver::onRegisterSurfaceDamage);
     connect(m_damageObserver, &X11DamageObserver::needRefresh, m_renderTask, &RenderTask::requestRefresh);
+    connect(m_renderThread, &QThread::finished, m_damageObserver, &QObject::deleteLater);
 
     //start the rendering thread
     m_renderThread->start();



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/91318e584c48abc9769f40ac79b0e0d81bb08c4c

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




More information about the vlc-commits mailing list