Re: [Interest] QApplication was not created in the main() thread.

2023-07-03 Thread Yauheni Pervenenka via Interest
Thiago, thanks

On Mon, 3 Jul 2023, 07:56 Thiago Macieira, 
wrote:

> On Saturday, 1 July 2023 06:37:20 PDT Yauheni Pervenenka via Interest
> wrote:
> > Hi, Konstantin, thanks for your reply, I have attached stack when QObject
> > created first time, the problem is that UB is already exists in Qt,
>
> No, it doesn't.
>
> > Q_CONSTRUCTOR_FUNCTION(initialize) and QBasicAtomicPointer
> > QCoreApplicationPrivate::theMainThread =
> > Q_BASIC_ATOMIC_INITIALIZER(nullptr);
> > should be called in next order, first should be initialized theMainThread
> > and after should be called Q_CONSTRUCTOR_FUNCTION(initialize) but it is
> not
> > guaranteed by standard, https://en.cppreference.com/w/cpp/language/siof
>
> Nope. The QBasicAtomicPointer is initialised at static time, meaning it is
> initialised *before* any code runs. It's guaranteed by the standard.
>
> Your diagnosis is incorrect.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Cloud Software Architect - Intel DCAI Cloud Engineering
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QApplication was not created in the main() thread.

2023-07-02 Thread Thiago Macieira
On Saturday, 1 July 2023 06:37:20 PDT Yauheni Pervenenka via Interest wrote:
> Hi, Konstantin, thanks for your reply, I have attached stack when QObject
> created first time, the problem is that UB is already exists in Qt,

No, it doesn't.

> Q_CONSTRUCTOR_FUNCTION(initialize) and QBasicAtomicPointer
> QCoreApplicationPrivate::theMainThread =
> Q_BASIC_ATOMIC_INITIALIZER(nullptr);
> should be called in next order, first should be initialized theMainThread
> and after should be called Q_CONSTRUCTOR_FUNCTION(initialize) but it is not
> guaranteed by standard, https://en.cppreference.com/w/cpp/language/siof

Nope. The QBasicAtomicPointer is initialised at static time, meaning it is 
initialised *before* any code runs. It's guaranteed by the standard.

Your diagnosis is incorrect.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering


smime.p7s
Description: S/MIME cryptographic signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QApplication was not created in the main() thread.

2023-07-01 Thread Konstantin Shegunov
On Fri, Jun 30, 2023 at 11:12 AM Yauheni Pervenenka via Interest <
interest@qt-project.org> wrote:

> Hi community,
> I was faced with a warning QApplication was not created in the main()
> thread. on windows only, it is very rare happen,
>

Almost certainly you're creating a static `QObject` instance that sets the
"main" thread, and whenever the application constructor runs it reports
this as error.
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QApplication was not created in the main() thread.

2023-07-01 Thread Yauheni Pervenenka via Interest
Hi, Konstantin, thanks for your reply, I have attached stack when QObject
created first time, the problem is that UB is already exists in Qt,
Q_CONSTRUCTOR_FUNCTION(initialize) and QBasicAtomicPointer
QCoreApplicationPrivate::theMainThread =
Q_BASIC_ATOMIC_INITIALIZER(nullptr);
should be called in next order, first should be initialized theMainThread
and after should be called Q_CONSTRUCTOR_FUNCTION(initialize) but it is not
guaranteed by standard, https://en.cppreference.com/w/cpp/language/siof


On Sat, Jul 1, 2023 at 8:09 AM Konstantin Shegunov 
wrote:

> On Fri, Jun 30, 2023 at 11:12 AM Yauheni Pervenenka via Interest <
> interest@qt-project.org> wrote:
>
>> Hi community,
>> I was faced with a warning QApplication was not created in the main()
>> thread. on windows only, it is very rare happen,
>>
>
> Almost certainly you're creating a static `QObject` instance that sets the
> "main" thread, and whenever the application constructor runs it reports
> this as error.
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest