[vlc-devel] [PATCH] qt: casting to children type in parent constructor is UB
Rémi Denis-Courmont
remi at remlab.net
Tue Apr 23 17:38:23 CEST 2019
Le tiistaina 23. huhtikuuta 2019, 10.51.59 EEST Pierre Lamot a écrit :
> children object isn't built yet.
>
> Fixes #22187
> ---
> modules/gui/qt/adapters/variables.hpp | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/modules/gui/qt/adapters/variables.hpp
> b/modules/gui/qt/adapters/variables.hpp index 710880cf23..930a7e2238 100644
> --- a/modules/gui/qt/adapters/variables.hpp
> +++ b/modules/gui/qt/adapters/variables.hpp
> @@ -112,17 +112,13 @@ public:
> , m_object(new VLCObjectHolderImpl<T>(nullptr))
> , m_property(property)
> {
> - resetObject<T>(object);
> - Derived* derived = static_cast<Derived*>(this);
> - connect(derived, &Derived::valueChangedInternal, this,
> &QVLCVariable<Derived, BaseType>::onValueChangedInternal,
> Qt::QueuedConnection); }
>
> virtual ~QVLCVariable()
> {
> if (m_object->get())
> {
> - Derived* derived = static_cast<Derived*>(this);
> - var_DelCallback(m_object->get(), qtu(m_property),
> value_modified, derived);
> + var_DelCallback(m_object->get(),
> qtu(m_property), value_modified, this); var_Destroy(m_object->get(),
> qtu(m_property));
Uh... Doesn't this incorrectly assume that pointer fixup is unnecessary?
--
雷米‧德尼-库尔蒙
http://www.remlab.net/
More information about the vlc-devel
mailing list