[vlc-commits] qt: medialib: remove QObject from MLVideo
Romain Vimont
git at videolan.org
Mon Jan 4 10:51:28 UTC 2021
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Fri Dec 18 14:53:36 2020 +0100| [fe782ffc856d89bf0248a39e979d89f4ff101155] | committer: Pierre Lamot
qt: medialib: remove QObject from MLVideo
MLVideo instances are created from a QThreadPool thread. As a
consequence, as a QObject, each one live (by default) in this separate
thread.
The behavior of dynamic properties or signals/slots would be confusing,
so do not inherit QObject.
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe782ffc856d89bf0248a39e979d89f4ff101155
---
modules/gui/qt/maininterface/mainui.cpp | 1 -
modules/gui/qt/medialibrary/mlvideo.cpp | 5 ++---
modules/gui/qt/medialibrary/mlvideo.hpp | 6 ++----
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index 962e0f91e4..a91dcd6c8a 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -182,7 +182,6 @@ void MainUI::registerQMLTypes()
registerAnonymousType<MLArtist>("org.videolan.medialib", 1);
registerAnonymousType<MLAlbumTrack>("org.videolan.medialib", 1);
registerAnonymousType<MLGenre>("org.videolan.medialib", 1);
- registerAnonymousType<MLVideo>("org.videolan.medialib", 1);
qmlRegisterType<AlbumContextMenu>( "org.videolan.medialib", 0, 1, "AlbumContextMenu" );
qmlRegisterType<ArtistContextMenu>( "org.videolan.medialib", 0, 1, "ArtistContextMenu" );
diff --git a/modules/gui/qt/medialibrary/mlvideo.cpp b/modules/gui/qt/medialibrary/mlvideo.cpp
index acedfd8f9b..10bb975e75 100644
--- a/modules/gui/qt/medialibrary/mlvideo.cpp
+++ b/modules/gui/qt/medialibrary/mlvideo.cpp
@@ -72,9 +72,8 @@ unsigned int AudioDescription::getSampleRate() const
return m_sampleRate;
}
-MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data, QObject* parent)
- : QObject( parent )
- , MLItem( MLItemId( data->i_id, VLC_ML_PARENT_UNKNOWN ) )
+MLVideo::MLVideo(vlc_medialibrary_t* ml, const vlc_ml_media_t* data)
+ : MLItem( MLItemId( data->i_id, VLC_ML_PARENT_UNKNOWN ) )
, m_ml( ml )
, m_title( QString::fromUtf8( data->psz_title ) )
, m_thumbnail( QString::fromUtf8( data->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl ) )
diff --git a/modules/gui/qt/medialibrary/mlvideo.hpp b/modules/gui/qt/medialibrary/mlvideo.hpp
index 58d105c3d3..604b17a37a 100644
--- a/modules/gui/qt/medialibrary/mlvideo.hpp
+++ b/modules/gui/qt/medialibrary/mlvideo.hpp
@@ -85,12 +85,10 @@ private:
Q_DECLARE_METATYPE(AudioDescription)
-class MLVideo : public QObject, public MLItem
+class MLVideo : public MLItem
{
- Q_OBJECT
-
public:
- MLVideo(vlc_medialibrary_t *ml, const vlc_ml_media_t *data, QObject *parent = nullptr);
+ MLVideo(vlc_medialibrary_t *ml, const vlc_ml_media_t *data);
QString getTitle() const;
QString getThumbnail();
More information about the vlc-commits
mailing list