QCA::initializer destructor crashes app

  • Hi,
    I have following problem, that app crashes when

    QCA::Initializer init;

    goes out of scope, to be more precisely, when destructor is invoked.
    It happens only on deployed application, which is installed on clean windows 7 without qt creator. The first time when I lunch app there, I can do whatever I want and it works flawless, but when I lunch app second time and invoke some qca methods like QCA::supportedFeatures(), application would crash when destructor will be invoked.
    When I lunch it second time and i won't invoke any qca methods, destructor will be invoked successfully.

    I moved QCA::Initializer object on the begining of the main function like I read here , the issue from that post was connected with linux, but it's always worth to try :D.

    I'm sure that destuctor is crasing app, beacouse, when I put some qdebugs in this way Ł

       QCA::Initializer init; 
       // some work with qca like QCA::supportedFeatures()
      qDebug() << __LINE__ ;
     qDebug() << __LINE__ ;

    onlz first qdebug will be printed before crash happens.

    Have you got any idea what should I check, maybe should i initialize it as a pointer ?

    I make a little changes in code to make it easier to reproduce by invoking qca method in main function, so it looks this way:

    int main(int argc, char *argv[])
        QCA::Initializer init;
        // code of application 
        QApplication a(argc, argv);
        qDebug() << __FILE__ << __LINE__ << QCA::supportedFeatures();
        // some application code 
        return  a.exec();

    After this modification, I launch app on clean windows and when i close the window it crashes. Debug is printed and it shows me that my library supports so many function:
    "("random", "md5", "sha1", "keystorelist", "sha0", "ripemd160", "md4", "sha224", "sha256", "sha384", "sha512", "hmac(md5)", "hmac(sha1)", "hmac(sha224)", "hmac(sha256)", "hmac(sha384)", "hmac(sha512)", "hmac(ripemd160)", "aes128-ecb", "aes128-cfb", "aes128-cbc", "aes128-cbc-pkcs7", "aes128-ofb", "aes128-ctr", "aes192-ecb", "aes192-cfb", "aes192-cbc", "aes192-cbc-pkcs7", "aes192-ofb", "aes192-ctr", "aes256-ecb", "aes256-cbc", "aes256-cbc-pkcs7", "aes256-cfb", "aes256-ofb", "aes256-ctr", "blowfish-ecb", "blowfish-cbc-pkcs7", "blowfish-cbc", "blowfish-cfb", "blowfish-ofb", "tripledes-ecb", "tripledes-cbc", "des-ecb", "des-ecb-pkcs7", "des-cbc", "des-cbc-pkcs7", "des-cfb", "des-ofb", "cast5-ecb", "cast5-cbc", "cast5-cbc-pkcs7", "cast5-cfb", "cast5-ofb", "pbkdf1(sha1)", "pbkdf2(sha1)", "pkey", "dlgroup", "rsa", "dsa", "dh", "cert", "csr", "crl", "certcollection", "pkcs12", "tls", "cms", "ca") "

    I think the problem is still with deinit() which is called in constructor of QCA::Initializer as I wrote before.

  • Lifetime Qt Champion


    Which version of Qt are you using ? And QCA ?

  • Hi,

    I have exactly the same problem.
    I use Qt 5.7, QCA 2.1.1, and msvc2015 32bit.
    My app crashes when "QCA::Initializer init;" goes out of scope.
    Has anybody an idea to solve the problem?


  • Lifetime Qt Champion

    You should move QCA's init after your app object creation.

    Qt's internal structures/data are ready to be used only after a QXXXApplication has been created.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.