QConsoleApplication,aboutToQuit and "signal" do not hit the breakpoints...



  • Following code, running in qtCreator (Windows 10) in the debug mode, does not reach breakpoints "brakepoint1" or "breakpoint2" upon clicking on "x" console window.
    What can be the case?
    Thanks!

    #include <QCoreApplication>
    #include <iostream>
    #include <signal.h>
     
    void cleanup(int sig)
    {
        std::cout << sig << "quitting \n"; // breakpoint 2
    }
     
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        QObject::connect(&a, &QCoreApplication::aboutToQuit, [&]() {
            std::cout << "about to quit\n"; //breakpoint 1
        });
        signal(SIGINT, cleanup);
        signal(SIGABRT, cleanup);
        signal(SIGTERM, cleanup);
     
        std::cout<< "about to run\n";
        return a.exec();
        std::cout<< "exiting\n";
    }
    

  • Moderators

    @toran

    Are "quitting \n" and "about to quit\n" printed?



  • Resolved, thanks to user "jefftee", in this thread.


Log in to reply
 

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