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

Yauheni Pervenenka yauheni.pervenenka at viber.com
Mon Jul 3 11:07:17 CEST 2023


Thiago, thanks

On Mon, 3 Jul 2023, 07:56 Thiago Macieira, <thiago.macieira at intel.com>
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<QThread>
> > 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 at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230703/ee7e9e84/attachment.htm>


More information about the Interest mailing list