[vlc-devel] [PATCH 3/3] qt: allow getCount to initiate the cache in MLBaseModel

Romain Vimont rom1v at videolabs.io
Thu Dec 17 13:06:49 UTC 2020


On Thu, Dec 17, 2020 at 02:01:25PM +0100, Pierre Lamot wrote:
> On 2020-12-17 13:40, Romain Vimont wrote:
> > On Thu, Dec 17, 2020 at 01:32:50PM +0100, Pierre Lamot wrote:
> > >   The count property might be accessed before browsing the model.
> > 
> > But if that's the case, m_cache should be nullptr, and the current
> > implementation should work, doesn't it?
> 
> this is rather about initializing the cache. My use case was something like:
> 
> MyModel {
>   id: model
>   ml: medialib
> }
> 
> Loader {
>   active: model.count > 0
>   sourceComponent: WidgetUsingMyModel {
>       // ommited [...]
>   }
> }
> 
> 
> In this case, the count property would stay to 0 as the model is never
> browsed, hence the chache is never created

Oh ok, makes sense then.

Regards


More information about the vlc-devel mailing list