[vlc-devel] [PATCH 2/3] qt: move default member initialisation in header for MLBaseModel for uniformity

Pierre Lamot pierre at videolabs.io
Thu Dec 17 12:32:49 UTC 2020


---
 modules/gui/qt/medialibrary/mlbasemodel.cpp | 5 -----
 modules/gui/qt/medialibrary/mlbasemodel.hpp | 8 ++++----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlbasemodel.cpp b/modules/gui/qt/medialibrary/mlbasemodel.cpp
index 794b82198f..4549dacb57 100644
--- a/modules/gui/qt/medialibrary/mlbasemodel.cpp
+++ b/modules/gui/qt/medialibrary/mlbasemodel.cpp
@@ -27,16 +27,11 @@ static constexpr ssize_t COUNT_UNINITIALIZED =
 
 MLBaseModel::MLBaseModel(QObject *parent)
     : QAbstractListModel(parent)
-    , m_ml(nullptr)
     , m_ml_event_handle( nullptr, [this](vlc_ml_event_callback_t* cb ) {
             assert( m_ml != nullptr );
             vlc_ml_event_unregister_callback( m_ml, cb );
         })
-    , m_need_reset( false )
 {
-    m_sort = VLC_ML_SORTING_DEFAULT;
-    m_sort_desc = false;
-
     connect( this, &MLBaseModel::resetRequested, this, &MLBaseModel::onResetRequested );
 }
 
diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp b/modules/gui/qt/medialibrary/mlbasemodel.hpp
index faef1c188a..d1057ac6b1 100644
--- a/modules/gui/qt/medialibrary/mlbasemodel.hpp
+++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp
@@ -142,15 +142,15 @@ public:
 protected:
     MLItemId m_parent;
 
-    vlc_medialibrary_t* m_ml;
+    vlc_medialibrary_t* m_ml = nullptr;
     MediaLib* m_mediaLib = nullptr;
     QString m_search_pattern;
-    vlc_ml_sorting_criteria_t m_sort;
-    bool m_sort_desc;
+    vlc_ml_sorting_criteria_t m_sort = VLC_ML_SORTING_DEFAULT;
+    bool m_sort_desc = false;
 
     std::unique_ptr<vlc_ml_event_callback_t,
                     std::function<void(vlc_ml_event_callback_t*)>> m_ml_event_handle;
-    bool m_need_reset;
+    bool m_need_reset = false;
 
     mutable std::unique_ptr<ListCache<std::unique_ptr<MLItem>>> m_cache;
 };
-- 
2.25.1



More information about the vlc-devel mailing list