QNetworkAccessManager crash 0xc0000409

  • Hello everyone,
    I've a strange problem with my Qt 5.13 application that this line

    QNetworkAccessManager * m_netAccessMngr = new QNetworkAccessManager(this);

    crashes in release mode. In Debug mode, it works fine.
    I've included all requested dll's but it is still crashing with the following message :

    Chemin d’accès du module défaillant: C:\Qt\Qt5.13.0\5.13.0\msvc2017\bin\Qt5Core.dll

    Doe's anyone has encountred the same problem ? Can anyone tell me what I must to do to fix this error.
    Thanks for your help.

  • Lifetime Qt Champion

    Just to be 100% sure.
    You name m_netAccessMngr suggest its a member of the class so that line would normally be
    m_netAccessMngr = new QNetworkAccessManager(this);
    as else you make a local variable and the real m_netAccessMngr (.h)
    is a dangling pointer.

    Also, it sounds you are running it from a deployment folder and not via Creator.
    Is this on the same PC as you develop or on a "clean" one ?

    Such crashes are normally due to it finding a wrong DLL version.

  • Thanks for reply.

    Exact, m_netAccessMngr is a global variable declared in .h and it's instancied in the constructor.
    I've generated the executable and run it with the required Qt 5.13 dll's as I've done with many Qt applications.

    Such crashes are normally due to it finding a wrong DLL version

    I agree but I'm sure I've put the correct Qt 5.13 dll's.
    Also I've installed many VC redistribuable but the problem persists.

  • Lifetime Qt Champion

    @mourad_bilog said in QNetworkAccessManager crash 0xc0000409:

    and it's instancied in the constructor.

    In that case you're code is wrong as @mrjj pointed out!
    It should be:

    m_netAccessMngr = new QNetworkAccessManager(this);

    else you're declaring a local variable with same name and don't initialise the global one.

Log in to reply