[vlc-commits] [Git][videolan/vlc][master] qml: fix race condition while initializing FlickableScrollHandler

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Mar 2 11:31:38 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
705f53e9 by Pierre Lamot at 2023-03-02T10:35:56+00:00
qml: fix race condition while initializing FlickableScrollHandler

fix: #27890

- - - - -


2 changed files:

- modules/gui/qt/util/flickable_scroll_handler.cpp
- modules/gui/qt/util/flickable_scroll_handler.hpp


Changes:

=====================================
modules/gui/qt/util/flickable_scroll_handler.cpp
=====================================
@@ -34,8 +34,6 @@ FlickableScrollHandler::FlickableScrollHandler(QObject *parent)
     });
 
     setScaleFactor(1.0);
-
-    QMetaObject::invokeMethod(this, &FlickableScrollHandler::init, Qt::QueuedConnection);
 }
 
 FlickableScrollHandler::~FlickableScrollHandler()
@@ -43,7 +41,11 @@ FlickableScrollHandler::~FlickableScrollHandler()
     detach();
 }
 
-void FlickableScrollHandler::init()
+void FlickableScrollHandler::classBegin()
+{
+}
+
+void FlickableScrollHandler::componentComplete()
 {
     assert(parent());
 


=====================================
modules/gui/qt/util/flickable_scroll_handler.hpp
=====================================
@@ -22,8 +22,9 @@
 #include <QQmlProperty>
 #include <QPointer>
 #include <QQuickItem>
+#include <QQmlParserStatus>
 
-class FlickableScrollHandler : public QObject
+class FlickableScrollHandler : public QObject, public QQmlParserStatus
 {
     Q_OBJECT
 
@@ -35,6 +36,8 @@ class FlickableScrollHandler : public QObject
     Q_PROPERTY(bool fallbackScroll MEMBER m_fallbackScroll NOTIFY fallbackScrollChanged FINAL)
     Q_PROPERTY(bool handleOnlyPixelDelta MEMBER m_handleOnlyPixelDelta NOTIFY handleOnlyPixelDeltaChanged FINAL)
 
+    Q_INTERFACES(QQmlParserStatus)
+
 public:
     explicit FlickableScrollHandler(QObject *parent = nullptr);
     ~FlickableScrollHandler();
@@ -46,6 +49,9 @@ public:
     void setScaleFactor(qreal newScaleFactor);
     void setEnabled(bool newEnabled);
 
+    void classBegin() override;
+    void componentComplete() override;
+
 signals:
     void initialized();
 
@@ -57,8 +63,6 @@ signals:
     void handleOnlyPixelDeltaChanged();
 
 private slots:
-    void init();
-
     void adjustScrollBarV();
     void adjustScrollBarH();
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/705f53e985104dcd52d684228cc923e9dbd9938b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/705f53e985104dcd52d684228cc923e9dbd9938b
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