[vlc-devel] [PATCH] qt: player_controller: use unique_ptr instead of QScopedPtr

Pierre Lamot pierre at videolabs.io
Thu Feb 13 13:27:30 CET 2020


Hi,

On 2020-02-13 12:14, Alexandre Janniaux wrote:
> Hi,
> 
> It seems this patch is not correct on the CI environment.
> 
> https://jenkins.videolan.org/job/vlc-continuous/job/vlc-cont-debian-x86_64/7564/console
> 
> It might be because of Qt 5.12 implementation which is
> different from mine (Qt 5.14 archlinux). Sorry for the
> inconvenience on the CI.
> 
> I will try to find why later, please ignore this patch
> for now.

qGetPtrHelper (hence the Q_DECLARE_PRIVATE macro) isn't compatible with 
std::unique_ptr in Qt 5.11 (debian version).
This will be ok with Qt 5.12

The other way might be to make the private part inherit QObjectPrivate 
and pass it to the Object Ctor, but this require to use qt private 
header, which is not worth it in my opinion.

I suggest to keep the code as it currently is.

> Regards,
> --
> Alexandre Janniaux
> Videolabs
> 
> On Tue, Jan 28, 2020 at 03:48:14PM +0100, Alexandre Janniaux wrote:
>> ---
>>  modules/gui/qt/player/player_controller.cpp | 2 +-
>>  modules/gui/qt/player/player_controller.hpp | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/modules/gui/qt/player/player_controller.cpp 
>> b/modules/gui/qt/player/player_controller.cpp
>> index b7e39086e9..4a2b0fd077 100644
>> --- a/modules/gui/qt/player/player_controller.cpp
>> +++ b/modules/gui/qt/player/player_controller.cpp
>> @@ -1024,7 +1024,7 @@ 
>> PlayerControllerPrivate::PlayerControllerPrivate(PlayerController 
>> *playercontrol
>> 
>>  PlayerController::PlayerController( intf_thread_t *_p_intf )
>>      : QObject(NULL)
>> -    , d_ptr( new PlayerControllerPrivate(this, _p_intf) )
>> +    , d_ptr { std::make_unique<PlayerControllerPrivate>(this, 
>> _p_intf) }
>>  {
>>      /* Audio Menu */
>>      menusAudioMapper = new QSignalMapper(this);
>> diff --git a/modules/gui/qt/player/player_controller.hpp 
>> b/modules/gui/qt/player/player_controller.hpp
>> index 3c792b47a9..54165f1449 100644
>> --- a/modules/gui/qt/player/player_controller.hpp
>> +++ b/modules/gui/qt/player/player_controller.hpp
>> @@ -432,7 +432,7 @@ private slots:
>> 
>>  private:
>>      Q_DECLARE_PRIVATE(PlayerController)
>> -    QScopedPointer<PlayerControllerPrivate> d_ptr;
>> +    std::unique_ptr<PlayerControllerPrivate> d_ptr;
>>      QSignalMapper *menusAudioMapper; //used by VLCMenuBar
>> 
>>      /* updateArt gui request */
>> --
>> 2.25.0
> _______________________________________________
> 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