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. QConsoleApplication,aboutToQuit and "signal" do not hit the breakpoints...
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • T Offline
    T Offline
    toran
    wrote on last edited by p3c0
    #1

    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";
    }
    
    jsulmJ 1 Reply Last reply
    0
    • T toran

      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";
      }
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @toran

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • T Offline
        T Offline
        toran
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

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