[vlc-devel] [PATCH 5/7] qt: expose parsing completion in network model

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Oct 22 11:46:14 CEST 2019



On Tue, Oct 22, 2019, at 11:35 AM, Pierre Lamot wrote:
> Hi,
> 
> >> a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp
> >> b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp
> >> index f1a15d020f..e8f8609187 100644
> >> --- a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp
> >> +++ b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp
> >> @@ -259,6 +259,9 @@ bool MLNetworkMediaModel::initializeMediaSources()
> >> 
> >> 
> >>      vlc_media_tree_Preparse( tree, libvlc, m_treeItem.media.get() );
> >> +    m_parsingPending = true;
> >> +    emit parsingPendingChanged(m_parsingPending);
> >> +
> 
> 
> >> +void MLNetworkMediaModel::onItemPreparseEnded(MediaSourcePtr
> >> mediaSource, input_item_node_t* node, enum input_item_preparse_status
> >> status)
> >> +{
> >> +    QMetaObject::invokeMethod(this, [this]() {
> >> +        m_parsingPending = false;
> >> +        emit parsingPendingChanged(false);
> >> +    });
> >> +}
> >> +
> 
> QMetaObject::invokeMethod will call the lambda within the object thread.

Which in this case, or in the case of any model objects, is the UI thread I suppose?

> 
> >> +    inline bool getParsingPending() const { return m_parsingPending; 
> >> }
> >> 
> 
> >>      bool m_canBeIndexed  = false;
> >> +    bool m_parsingPending = false;
> > 
> > Shouldn't this be atomic?
> 
> this is only read and set from the object (UI) thread.
>

Ok, fine by me then!

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list