[vlc-commits] [Git][videolan/vlc][master] qt: add missing disconnect in `VideoSurface`

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Feb 1 14:01:05 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6e67d031 by Fatih Uzunoglu at 2025-02-01T13:40:07+00:00
qt: add missing disconnect in `VideoSurface`

- - - - -


2 changed files:

- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/maininterface/videosurface.hpp


Changes:

=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -17,7 +17,6 @@
  *****************************************************************************/
 #include "videosurface.hpp"
 #include "maininterface/mainctx.hpp"
-#include "util/vlchotkeyconverter.hpp"
 #include <QSGRectangleNode>
 #include <QThreadPool>
 #include <vlc_window.h>
@@ -209,8 +208,6 @@ VideoSurface::VideoSurface(QQuickItem* parent)
     setAcceptedMouseButtons(Qt::AllButtons);
     setFlag(ItemAcceptsInputMethod, true);
 
-    m_wheelEventConverter = new WheelToVLCConverter(this);
-
     {
         connect(this, &QQuickItem::widthChanged, this, &VideoSurface::updateSurfaceSize);
         connect(this, &QQuickItem::heightChanged, this, &VideoSurface::updateSurfaceSize);
@@ -308,7 +305,7 @@ void VideoSurface::keyPressEvent(QKeyEvent* event)
 #if QT_CONFIG(wheelevent)
 void VideoSurface::wheelEvent(QWheelEvent *event)
 {
-    m_wheelEventConverter->wheelEvent(event);
+    m_wheelEventConverter.wheelEvent(event);
     event->accept();
 }
 #endif
@@ -392,6 +389,8 @@ void VideoSurface::setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurface
 
     if (m_provider)
     {
+        disconnect(this, nullptr, m_provider, nullptr);
+        disconnect(&m_wheelEventConverter, nullptr, m_provider, nullptr);
         disconnect(m_provider, nullptr, this, nullptr);
     }
 
@@ -408,7 +407,7 @@ void VideoSurface::setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurface
         connect(this, &VideoSurface::surfacePositionChanged, m_provider, &VideoSurfaceProvider::surfacePositionChanged);
         connect(this, &VideoSurface::surfaceScaleChanged, m_provider, &VideoSurfaceProvider::surfaceScaleChanged);
 
-        connect(m_wheelEventConverter, &WheelToVLCConverter::vlcWheelKey, m_provider, &VideoSurfaceProvider::onMouseWheeled);
+        connect(&m_wheelEventConverter, &WheelToVLCConverter::vlcWheelKey, m_provider, &VideoSurfaceProvider::onMouseWheeled);
         connect(m_provider, &VideoSurfaceProvider::videoEnabledChanged, this, &VideoSurface::updateSurface);
 
         setFlag(ItemHasContents, true);


=====================================
modules/gui/qt/maininterface/videosurface.hpp
=====================================
@@ -23,6 +23,7 @@
 #include <QRunnable>
 #include <QPointer>
 #include "qt.hpp"
+#include "util/vlchotkeyconverter.hpp"
 
 #include <vlc_threads.h>
 
@@ -33,7 +34,6 @@ extern "C" {
 Q_MOC_INCLUDE( "maininterface/mainctx.hpp")
 
 class MainCtx;
-class WheelToVLCConverter;
 
 class WindowResizer :
     public QRunnable
@@ -153,7 +153,7 @@ protected slots:
 private:
     QPointF m_oldHoverPos;
 
-    WheelToVLCConverter* m_wheelEventConverter = nullptr;
+    WheelToVLCConverter m_wheelEventConverter;
 
     QPointer<VideoSurfaceProvider> m_provider;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e67d0312d57880d446f238eee55f968a7314f1b

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


VideoLAN code repository instance


More information about the vlc-commits mailing list