[Interest] Crash when creating QNetworkAccessManager in qt 5.14.x

coroberti . coroberti at gmail.com
Tue Feb 4 17:13:21 CET 2020


On Tue, Feb 4, 2020 at 6:07 PM maitai <maitai at virtual-winds.org> wrote:
>
> Thanks Robert and Thiago,
>
> If I create it on the stack instead of on the heap same mystery, i.e if
> I create it before qApp all good, if after it crashes
>
> this works:
>      qWarning()<<"test";
>      QNetworkAccessManager inet;
>      qWarning()<<"after test";
>      QApplication app(argc, argv);
>
> this crashes:
>      QApplication app(argc, argv);
>      qWarning()<<"test";
>
Kind regards,
Robert Iakobashvili
............................ inet;
>      qWarning()<<"after test";
>
> Interesting is that in that last case I have a new message in the
> console:
>
> Failed to initialize COM library.  Error code = 0x -7ffefefa, before my
> "test" qWarning()...
>
> Googling it tells me it's about using WMI and it's true I do have some
> WMI functions defined statically in an object.
>
> Still that was working fine before 5.14.0 (5.13.2 for instance), and why
> creating/deleting it before qApp fixes it all is beyond my level of
> understanding...
>
> Philippe Lelong.
>
Dear Philippe,
Beyond any doubts,

1. QApplication should be prior to QNetworkAccessManager;
2. There is some memory issue only triggered by update to 5.14;
3. Look at all places in QNetworkAccessManager slots where you are
doing deleteLater(),
kinda for reply objects.
Try to comment them out temporarily and see if you still reproduce the crash.

Take care,

Kind regards,
Robert


More information about the Interest mailing list