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. QT exited with code -1073741510
Forum Updated to NodeBB v4.3 + New Features

QT exited with code -1073741510

Scheduled Pinned Locked Moved General and Desktop
14 Posts 5 Posters 4.7k Views 1 Watching
  • 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.
  • JKSHJ Offline
    JKSHJ Offline
    JKSH
    Moderators
    wrote on last edited by
    #5

    You don't need an event loop, so don't call exec().

    @
    // Replace this...
    return a.exec();

    // ...with this:
    return 0;
    @

    If you call exec(), you need to quit your program by triggering QCoreApplication::exit() or QCoreApplication::quit()

    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

    1 Reply Last reply
    0
    • F Offline
      F Offline
      foxgod
      wrote on last edited by
      #6

      // Replace this...
      return a.exec();

      // ...with this:
      return 0;

      but how can i get i get terminate message from QCoreApplication::notify() or else method.

      1 Reply Last reply
      0
      • jeremy_kJ Offline
        jeremy_kJ Offline
        jeremy_k
        wrote on last edited by
        #7

        I don't think QCoreApplication::notify(), which is used to deliver events, is what you want.

        There's a QCoreApplication::aboutToQuit() signal that indicates that the main event loop is about to terminate, which works pretty well for applications that end main() with "return app.exec();" Minus an event loop, much of Qt won't be of use.

        Perhaps a function that uses printf() and is registered with atexit() will work.

        Asking a question about code? http://eel.is/iso-c++/testcase/

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #8

          [quote author="foxgod" date="1402987828"]but how can i get i get terminate message from QCoreApplication::notify() or else method.[/quote]What do you want to do with the message?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • F Offline
            F Offline
            foxgod
            wrote on last edited by
            #9

            i want to get console close's message ,when i know the console is closed,then i want to execute some program.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              foxgod
              wrote on last edited by
              #10

              @void terminateTest()
              {
              qDebug()<<"program is over"<<endl;
              rootThreadpro.aboutToQuit();
              }

              int main(int argc, char *argv[])
              {
              QCoreApplication a(argc, argv);

              qDebug()<<"Root\n";
              atexit(terminateTest);
              rootThreadpro.StartServer(); 
              return a.exec&#40;&#41;;
              

              }
              @

              this can solve currently question , antthing also?

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #11

                [quote author="foxgod" date="1402989786"]i want to get console close's message ,when i know the console is closed,then i want to execute some program.[/quote]You cannot get that message in your application. When you close the console, it terminates your application.

                Just launch your other program before return 0;

                I don't recommend closing a console application by clicking the 'X' or Ctrl-C. If your program terminates like this, it won't be able to clean up. Sometimes, this can corrupt your data files.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • jeremy_kJ Offline
                  jeremy_kJ Offline
                  jeremy_k
                  wrote on last edited by
                  #12

                  It looks like atexit() won't work without some additional handling.

                  bq. Functions registered using atexit() (and on_exit(3)) are not called if a process terminates abnormally because of the delivery of a signal.

                  Asking a question about code? http://eel.is/iso-c++/testcase/

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #13

                    Like I said, do not use Ctrl-C, and do not close your console by clicking the 'X'. These are dangerous ways to stop a program.

                    Why don't you quit your program properly?

                    Or, if you really want to close by clicking the 'X', create a QWidget-based GUI. Then, when you click the 'X', you will get a QCloseEvent.

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • jeremy_kJ Offline
                      jeremy_kJ Offline
                      jeremy_k
                      wrote on last edited by
                      #14

                      Sometimes users do unexpected things.

                      Asking a question about code? http://eel.is/iso-c++/testcase/

                      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