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

Rémi Denis-Courmont remi at remlab.net
Fri Mar 13 16:34:03 CET 2020


Le perjantaina 13. maaliskuuta 2020, 16.00.29 EET Steve Lhomme a écrit :
> A few lines above we already use the variable:
> var_Get(m_object->get(), qtu(m_property), &currentvalue)

That sounds like a bug.

It's generally bad manners to add a callback without a reference. In specific 
cases, you can assume that it works, but I don't think a generic helper should 
be making that sort of assumptions.

> ---
>  modules/gui/qt/util/variables.hpp | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/modules/gui/qt/util/variables.hpp
> b/modules/gui/qt/util/variables.hpp index dff7e84bcb2..08f1de8ef07 100644
> --- a/modules/gui/qt/util/variables.hpp
> +++ b/modules/gui/qt/util/variables.hpp
> @@ -154,7 +154,6 @@ public:
>                  emit derived->valueChanged( m_value );
>              }
> 
> -            var_Create(m_object->get(), qtu(m_property),
> VLCVarTypeTraits<BaseType>::var_type); var_AddCallback(m_object->get(),
> qtu(m_property), value_modified, &cref); }
>      }
> @@ -164,7 +163,6 @@ public:
>          if (m_object->get())
>          {
>              var_DelCallback( m_object->get(), qtu(m_property),
> value_modified, &cref ); -            var_Destroy(m_object->get(),
> qtu(m_property));
>              m_object->clear();
>          }
>      }


-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list