[vlc-devel] [PATCH 1/3] qt: fix uninitialized member in MLBaseModel

Pierre Lamot pierre at videolabs.io
Thu Dec 17 13:05:49 UTC 2020


On 2020-12-17 14:01, Romain Vimont wrote:
> On Thu, Dec 17, 2020 at 01:53:57PM +0100, Pierre Lamot wrote:
>> On 2020-12-17 13:43, Romain Vimont wrote:
>> > On Thu, Dec 17, 2020 at 01:32:48PM +0100, Pierre Lamot wrote:
>> > > ---
>> > >  modules/gui/qt/medialibrary/mlbasemodel.hpp | 2 +-
>> > >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > >
>> > > diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp
>> > > b/modules/gui/qt/medialibrary/mlbasemodel.hpp
>> > > index a0529700d8..faef1c188a 100644
>> > > --- a/modules/gui/qt/medialibrary/mlbasemodel.hpp
>> > > +++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp
>> > > @@ -143,7 +143,7 @@ protected:
>> > >      MLItemId m_parent;
>> > >
>> > >      vlc_medialibrary_t* m_ml;
>> > > -    MediaLib* m_mediaLib;
>> > > +    MediaLib* m_mediaLib = nullptr;
>> >
>> > In theory, it is initialized "immediately" (almost like in a
>> > constructor, except that it's initialized just after via a QML property
>> > because it's QML). Nothing should use it uninitialized.
>> 
>> Initialisation order is not warranted in QML
> 
> Yes, but the other properties accessors never use m_mediaLib.

indirectly by calling validateCache which uses it.

> 
>> I had some crash accessing the count property from another place
> 
> The count property (getCount()) does not use m_mediaLib (except in 
> patch
> 3 of this patchset, but IMO it should not).
> 
>> 
>> >
>> > But I'm ok with setting it to nullptr to improve debugging. Same with
>> > m_ml just above btw.
>> >
>> > >      QString m_search_pattern;
>> > >      vlc_ml_sorting_criteria_t m_sort;
>> > >      bool m_sort_desc;
>> > > --
>> > > 2.25.1
>> > >
>> > > _______________________________________________
>> > > vlc-devel mailing list
>> > > To unsubscribe or modify your subscription options:
>> > > https://mailman.videolan.org/listinfo/vlc-devel
>> > _______________________________________________
>> > vlc-devel mailing list
>> > To unsubscribe or modify your subscription options:
>> > https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list