[vlc-devel] [vlc-commits] qt: use QAtomicInt

Steve Lhomme robux4 at gmail.com
Fri Jun 26 10:32:01 CEST 2015


On Thu, Jun 25, 2015 at 11:09 PM, Rémi Denis-Courmont <git at videolan.org> wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jun 26 00:06:44 2015 +0300| [d2571e643edb0f1cb217805ef8d5ac172d59a864] | committer: Rémi Denis-Courmont
>
> qt: use QAtomicInt
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d2571e643edb0f1cb217805ef8d5ac172d59a864
> ---
>
>  modules/gui/qt4/dialogs/messages.cpp |    4 ++--
>  modules/gui/qt4/dialogs/messages.hpp |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/modules/gui/qt4/dialogs/messages.cpp b/modules/gui/qt4/dialogs/messages.cpp
> index 21c1110..d23007f 100644
> --- a/modules/gui/qt4/dialogs/messages.cpp
> +++ b/modules/gui/qt4/dialogs/messages.cpp
> @@ -146,7 +146,7 @@ MessagesDialog::~MessagesDialog()
>
>  void MessagesDialog::changeVerbosity( int i_verbosity )
>  {
> -    atomic_store( &this->verbosity, i_verbosity );
> +    verbosity = i_verbosity;
>  }
>
>  void MessagesDialog::updateConfig()
> @@ -340,7 +340,7 @@ void MessagesDialog::MsgCallback( void *self, int type, const vlc_log_t *item,
>  {
>      MessagesDialog *dialog = (MessagesDialog *)self;
>      char *str;
> -    int verbosity = atomic_load( &dialog->verbosity );
> +    int verbosity = dialog->verbosity;

This fails to build for me in msys2+mingw64.
`error: cannot convert 'QAtomicInt' to 'int' in initialization`

It works if I use this
int verbosity = dialog->verbosity.load();


>      if( verbosity < 0 || verbosity < (type - VLC_MSG_ERR)
>       || unlikely(vasprintf( &str, format, ap ) == -1) )
> diff --git a/modules/gui/qt4/dialogs/messages.hpp b/modules/gui/qt4/dialogs/messages.hpp
> index a8d5804..0491a8f 100644
> --- a/modules/gui/qt4/dialogs/messages.hpp
> +++ b/modules/gui/qt4/dialogs/messages.hpp
> @@ -28,8 +28,8 @@
>  #include "util/singleton.hpp"
>  #include "ui/messages_panel.h"
>  #include <stdarg.h>
> -#include <vlc_atomic.h>
>  #include <QMutex>
> +#include <QAtomicInt>
>
>  class QPushButton;
>  class QTreeWidget;
> @@ -49,7 +49,7 @@ private:
>      void sinkMessage( const MsgEvent * );
>      bool matchFilter( const QString& );
>
> -    atomic_int verbosity;
> +    QAtomicInt verbosity;
>      static void MsgCallback( void *, int, const vlc_log_t *, const char *,
>                               va_list );
>
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list