[vlc-devel] [PATCH 1/5] qt: varchoicemodel: don't create variables we already read from

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 13 15:04:45 CET 2020


On 2020-03-13 15:00, Steve Lhomme wrote:
> A few lines above we do:
> var_Get( m_object->get(), qtu(m_varname), &currentValue)
> 
> If the variable didn't exist we wouldn't reach this code.
> ---
>   modules/gui/qt/util/varchoicemodel.hpp | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/modules/gui/qt/util/varchoicemodel.hpp b/modules/gui/qt/util/varchoicemodel.hpp
> index 9f5b20729ad..658af82adfa 100644
> --- a/modules/gui/qt/util/varchoicemodel.hpp
> +++ b/modules/gui/qt/util/varchoicemodel.hpp
> @@ -125,7 +125,6 @@ bool VLCVarChoiceModel::resetObject(T* p_object)
>       {
>           var_DelCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_callback, this);
>           var_DelListCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_list_callback, this);

Not sure which of the two variable versions is used with 
var_DelListCallback() but it may potentially use the wrong one, not 
delete it, and then the callback may still be called when it shouldn't.

Alternatively the callback may be set on a variable and read from the 
other one and thus never been used/called.

> -        var_Destroy(m_object->get(), qtu(m_varname));
>       }
>       m_object->reset(p_object, true);
>   
> @@ -209,7 +208,6 @@ bool VLCVarChoiceModel::resetObject(T* p_object)
>       free(val_list);
>       free(val_title);
>   
> -    var_Create(m_object->get(), qtu(m_varname), m_type);
>       var_AddCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_callback, this);
>       var_AddListCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_list_callback, this);
>   
> -- 
> 2.17.1
> 
> _______________________________________________
> 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