Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Test successful but the application crashes
Qt 6.11 is out! See what's new in the release blog

Test successful but the application crashes

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 673 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AkshayFP
    wrote on last edited by AkshayFP
    #1

    My tests are passing but I get a crash occurred error. I have no idea why. Following is the error:

    QML debugging is enabled. Only use this in a safe environment.
    ********* Start testing of TestSettings *********
    Config: Using QtTest library 6.2.2, Qt 6.2.2 (x86_64-little_endian-llp64 shared (dynamic) release build; by GCC 11.2.0), windows 10
    PASS   : TestSettings::initTestCase()
    PASS   : TestSettings::test_getTimeFormat24hour()
    PASS   : TestSettings::cleanupTestCase()
    Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 1ms
    ********* Finished testing of TestSettings *********
    A crash occurred in C:\Users\gollaha\Code\cook-ui-modular-qt\build-Test_cook-ui-modular-qt-Desktop_Qt_6_2_2_MinGW_64_bit-Debug\debug\Test_cook-ui-modular-qt.exe.
    Function time: 0ms Total time: 1ms
    
    Exception address: 0x00007ff7876829dd
    Exception code   : 0xc0000005
    
    Stack:
    #  1: ZN24QAbstractItemModelTesterC1EP18QAbstractItemModelP7QObject() - 0x00007ffa585a69f0
    #  2: UnhandledExceptionFilter() - 0x00007ffa9a9eb610
    #  3: memset() - 0x00007ffa9d093e00
    #  4: _C_specific_handler() - 0x00007ffa9d07c6d0
    #  5: _chkstk() - 0x00007ffa9d091fb0
    #  6: RtlRaiseException() - 0x00007ffa9d041020
    #  7: KiUserExceptionDispatcher() - 0x00007ffa9d090bd0
    #  8: Unable to obtain symbol
    #  9: Unable to obtain symbol
    # 10: Unable to obtain symbol
    # 11: Unable to obtain symbol
    # 12: BaseThreadInitThunk() - 0x00007ffa9b5e7020
    # 13: RtlUserThreadStart() - 0x00007ffa9d042630
    

    *.pro file contains:

    QT += testlib
    QT += gui
    QT += qmltest
    CONFIG += qt warn_on qmltestcase depend_includepath testcase
    
    TEMPLATE = app
    
    DISTFILES += \
        tst_idontknow.qml
    
    SOURCES += \
    #    main.cpp \
        tst_Settings.cpp \
        ../cook-ui-modular-qt/App/UserInterface/backend.cpp \
        ../cook-ui-modular-qt/App/UserInterface/Clock.cpp \
        ../cook-ui-modular-qt/App/UserInterface/ConnectedSocketClient.cpp \
        ../cook-ui-modular-qt/App/UserInterface/DrawerItems.cpp \
        ../cook-ui-modular-qt/App/UserInterface/ErdBridge.cpp \
        ../cook-ui-modular-qt/App/UserInterface/Settings.cpp \
    
    HEADERS += ../cook-ui-modular-qt/App/UserInterface/backend.h \
        ../cook-ui-modular-qt/App/UserInterface/Clock.h \
        ../cook-ui-modular-qt/App/UserInterface/ConnectedSocketClient.h \
        ../cook-ui-modular-qt/App/UserInterface/DrawerItems.h \
        ../cook-ui-modular-qt/App/UserInterface/ErdBridge.h \
        ../cook-ui-modular-qt/App/UserInterface/Settings.h
    
    
    RESOURCES += ../cook-ui-modular-qt/App/UserInterface/qml.qrc
    RESOURCES += ../cook-ui-modular-qt/App/UserInterface/fonts.qrc
    
    INCLUDEPATH += ../cook-ui-modular-qt/App/UserInterface
    INCLUDEPATH += ../cook-ui-modular-qt/App/ConnectedSocket
    

    tst_Settings.cpp contains:

    #include <QObject>
    //#include <QtQuickTest>
    #include <QTest>
    #include <QDebug>
    #include "Settings.h"
    #include "ErdBridge.h"
    
    class TestSettings: public QObject
    {
        Q_OBJECT
    public:
        TestSettings();
        ~TestSettings();
    
    private:
        ErdBridge *erdBridget;
        Settings *settings;
    
    private slots:
        void test_getTimeFormat24hour();
    
    };
    
    TestSettings::TestSettings()
    {
    
        settings = new Settings(erdBridget, nullptr);
    }
    
    TestSettings::~TestSettings()
    {
        delete settings;
        delete erdBridget;
    }
    
    void TestSettings::test_getTimeFormat24hour()
    {
        QCOMPARE(settings->getTimeFormat24hour(), false);
    }
    
    //QUICK_TEST_MAIN_WITH_SETUP(mytest, TestSettings)
    QTEST_MAIN(TestSettings)
    
    #include "tst_Settings.moc"
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      As always - start your app with a debugger and see where it crashes, fix it. From what I see erdBridget is not initialized so delete will crash

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved