Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qtcreator crashes stopping the application
Forum Update on Monday, May 27th 2025

qtcreator crashes stopping the application

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
34 Posts 5 Posters 4.9k 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
    abarmotov
    wrote on last edited by
    #1

    Which signal QtCreator sends to application then stopping it ?
    Application has signal handlers on SIGINT and SIGTERM (and works well from console) but crashes from creator
    QtCreator v.7.0.2, ubuntu 20.04

    JonBJ 1 Reply Last reply
    0
    • A abarmotov

      Which signal QtCreator sends to application then stopping it ?
      Application has signal handlers on SIGINT and SIGTERM (and works well from console) but crashes from creator
      QtCreator v.7.0.2, ubuntu 20.04

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @abarmotov
      Well most all signal handling is done by gdb, not Creator. What "crashes" when you do what? I certainly have SIGINT handling in my application and works fine under gdb/Creator. (Though I admit I do not use Creator 7.x, and wouldn't use any of the latest stuff.) Have you tried disabling your program's signal handling temporarily to see if the "crashing" goes away?

      There should be a "debugger log window".: Window > Views > Debugger Log. This shows communicatins between Creator and gdb. That might tell you what communications happened that you are interested in.

      Interesting blog in https://myprogrammingnotes.com/qt-creator-interact-debugger-gdb.html.

      Code at https://github.com/qt-creator/qt-creator/blob/master/src/plugins/debugger/gdb/gdbengine.cpp. If you asked me to guess I'd hazard GdbEngine::interruptInferior()

      No sign of any Linux signals being used to gdb. If you find otherwise let me know! :)

      A JonBJ 2 Replies Last reply
      0
      • JonBJ JonB

        @abarmotov
        Well most all signal handling is done by gdb, not Creator. What "crashes" when you do what? I certainly have SIGINT handling in my application and works fine under gdb/Creator. (Though I admit I do not use Creator 7.x, and wouldn't use any of the latest stuff.) Have you tried disabling your program's signal handling temporarily to see if the "crashing" goes away?

        There should be a "debugger log window".: Window > Views > Debugger Log. This shows communicatins between Creator and gdb. That might tell you what communications happened that you are interested in.

        Interesting blog in https://myprogrammingnotes.com/qt-creator-interact-debugger-gdb.html.

        Code at https://github.com/qt-creator/qt-creator/blob/master/src/plugins/debugger/gdb/gdbengine.cpp. If you asked me to guess I'd hazard GdbEngine::interruptInferior()

        No sign of any Linux signals being used to gdb. If you find otherwise let me know! :)

        A Offline
        A Offline
        abarmotov
        wrote on last edited by
        #3

        @JonB thanks for answer

        1. application running without gdb - just "Run" with Ctrl+R
        2. then i stop app with "red button" - in console creator prints "... myapp crashed"
        3. as I remember, on version 6 it worked as it should - so it is a bug of v.7 or a new behavior ?
        JonBJ 2 Replies Last reply
        0
        • A abarmotov

          @JonB thanks for answer

          1. application running without gdb - just "Run" with Ctrl+R
          2. then i stop app with "red button" - in console creator prints "... myapp crashed"
          3. as I remember, on version 6 it worked as it should - so it is a bug of v.7 or a new behavior ?
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @abarmotov said in qtcreator crashes stopping the application:

          as I remember, on version 6 it worked as it should - so it is a bug of v.7 or a new behavior ?

          Ah, well don't you think that says it all?!

          Experts may slap me down, but from what I have seen (in posts) I wouldn't touch Creator 7 or Qt 6 with a barge-pole.

          • Did you at least try removing your signal handlers?
          • Would you consider "downgrading" to Creator 6? What do you get out of 7 that you need?
          A 1 Reply Last reply
          0
          • cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote on last edited by
            #5

            Please open a bug report at https://bugreports.qt.io/

            Qt Creator crashing is always worth a bug report and ... it shouldn't happen. 😊

            1 Reply Last reply
            0
            • J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by J.Hilk
              #6

              If I understand the op correctly, that QtCreator is not crashing, but his application is when he presses the "big" red stop button above the integrated terminal inside QtCreator.

              That's not unexpected, IIRC Creator sends SIGTERM and/or SIGKILL to the application process when that button is pressed and thats not a clean exit for any program.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              2
              • A abarmotov

                @JonB thanks for answer

                1. application running without gdb - just "Run" with Ctrl+R
                2. then i stop app with "red button" - in console creator prints "... myapp crashed"
                3. as I remember, on version 6 it worked as it should - so it is a bug of v.7 or a new behavior ?
                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @abarmotov said in qtcreator crashes stopping the application:

                application running without gdb - just "Run" with Ctrl+R

                Now that I understand you were never running under debugger, which I thought you were: have you indeed tried running it under debugger (Debug button)? If your code really is misbehaving in its signal handlers you may be able to debug that successfully.

                1 Reply Last reply
                0
                • JonBJ JonB

                  @abarmotov said in qtcreator crashes stopping the application:

                  as I remember, on version 6 it worked as it should - so it is a bug of v.7 or a new behavior ?

                  Ah, well don't you think that says it all?!

                  Experts may slap me down, but from what I have seen (in posts) I wouldn't touch Creator 7 or Qt 6 with a barge-pole.

                  • Did you at least try removing your signal handlers?
                  • Would you consider "downgrading" to Creator 6? What do you get out of 7 that you need?
                  A Offline
                  A Offline
                  abarmotov
                  wrote on last edited by
                  #8

                  @JonB said in qtcreator crashes stopping the application:

                  Would you consider "downgrading" to Creator 6? What do you get out of 7 that you need?

                  1. I noticed that v.7 is faster in clang code analysis, so not planned back to v.6
                  2. qtcretor not crasing - but my app is
                  3. I think that v.6 gave time to myapp to work out on the SIGTERM signal, but now it does not
                  4. will make bugreport
                  JonBJ 1 Reply Last reply
                  0
                  • A abarmotov

                    @JonB said in qtcreator crashes stopping the application:

                    Would you consider "downgrading" to Creator 6? What do you get out of 7 that you need?

                    1. I noticed that v.7 is faster in clang code analysis, so not planned back to v.6
                    2. qtcretor not crasing - but my app is
                    3. I think that v.6 gave time to myapp to work out on the SIGTERM signal, but now it does not
                    4. will make bugreport
                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @abarmotov said in qtcreator crashes stopping the application:

                    I think that v.6 gave time to myapp to work out on the SIGTERM signal, but now it does not

                    Like I last wrote: have you at least tried Debug instead of Run to see what happens?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      abarmotov
                      wrote on last edited by
                      #10

                      i run under debugger - no crashes in my app

                      but gdb not enters in my signal handler too - maybe creator(gdb) intercepted it

                      then i try to kill myapp outside from console - creator saw it, then show popup window about signal and then i continued - app exits with no error

                      JonBJ 1 Reply Last reply
                      0
                      • A abarmotov

                        i run under debugger - no crashes in my app

                        but gdb not enters in my signal handler too - maybe creator(gdb) intercepted it

                        then i try to kill myapp outside from console - creator saw it, then show popup window about signal and then i continued - app exits with no error

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #11

                        @abarmotov
                        Try putting a breakpoint on the signal handler function.
                        IIRC the signal first goes to gdb, then you have to continue for it to be delivered to program.
                        The point to discover is whether your signal handler ever gets hit at all --- even an fprintf(stderr) or qDebug() as first statement in handler might tell you.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          abarmotov
                          wrote on last edited by
                          #12

                          somehow no breakpoint hit in signal

                          JonBJ 1 Reply Last reply
                          0
                          • A abarmotov

                            somehow no breakpoint hit in signal

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #13

                            @abarmotov
                            Need to determine if @J-Hilk's

                            IIRC Creator sends SIGTERM and/or SIGKILL to the application process when that button is pressed

                            is right. Like I just wrote, put some fprintf(stderr) or qDebug() as first statement in handler.

                            BTW, do you want to show what code you actually do have in your signal handler(s)?

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              abarmotov
                              wrote on last edited by
                              #14
                              1. where is printf in handler
                              2. i will show code little latter, and attach to bugreport - there is no secret, but i need to remove excess code
                              JonBJ 1 Reply Last reply
                              0
                              • A abarmotov
                                1. where is printf in handler
                                2. i will show code little latter, and attach to bugreport - there is no secret, but i need to remove excess code
                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #15

                                @abarmotov said in qtcreator crashes stopping the application:

                                where is printf in handler

                                What do you mean by this? Unless you are ignoring the signals you have specified a function to be executed when the signals arrive. That is a "handler" function. You have some code in that function? I am suggesting you might put a fprintf(stderr, "Caught signal!\n") or qDebug() << "Caught signal!" as the first statement in whatever you have, so that we might see whether it is ever hit (in case breakpoints aren't working right).

                                1 Reply Last reply
                                1
                                • A Offline
                                  A Offline
                                  abarmotov
                                  wrote on last edited by
                                  #16
                                  1. create new app in creator
                                  2. add some little code "signalhandler"
                                  3. run it Ctrl-R
                                    4.1 kill from creator
                                    4.2 kill from outside konsoles
                                  #include "mainwindow.h"
                                  #include <QApplication>
                                  #include <unistd.h>
                                  #include <signal.h>
                                  
                                  void signalhandler(int sig) {
                                  	printf("SIG = %i\n", sig);
                                  	int ExitHelperCode = 0;
                                  	if (sig == SIGINT || sig == SIGTERM) ExitHelperCode = 123;
                                  	else if (sig == SIGUSR1) ExitHelperCode = 124;
                                  	qApp->exit(ExitHelperCode);
                                  }
                                  
                                  int main(int argc, char *argv[])
                                  {
                                  	signal(SIGINT,  signalhandler);
                                  	signal(SIGTERM, signalhandler);
                                  	QApplication a(argc, argv);
                                  	MainWindow w;
                                  	w.show();
                                  	return a.exec();
                                  }
                                  
                                  
                                  JonBJ 1 Reply Last reply
                                  0
                                  • A abarmotov
                                    1. create new app in creator
                                    2. add some little code "signalhandler"
                                    3. run it Ctrl-R
                                      4.1 kill from creator
                                      4.2 kill from outside konsoles
                                    #include "mainwindow.h"
                                    #include <QApplication>
                                    #include <unistd.h>
                                    #include <signal.h>
                                    
                                    void signalhandler(int sig) {
                                    	printf("SIG = %i\n", sig);
                                    	int ExitHelperCode = 0;
                                    	if (sig == SIGINT || sig == SIGTERM) ExitHelperCode = 123;
                                    	else if (sig == SIGUSR1) ExitHelperCode = 124;
                                    	qApp->exit(ExitHelperCode);
                                    }
                                    
                                    int main(int argc, char *argv[])
                                    {
                                    	signal(SIGINT,  signalhandler);
                                    	signal(SIGTERM, signalhandler);
                                    	QApplication a(argc, argv);
                                    	MainWindow w;
                                    	w.show();
                                    	return a.exec();
                                    }
                                    
                                    
                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #17

                                    @abarmotov

                                    • Did you ever get to see the output from the printf("SIG = %i\n", sig); which is there?

                                    • Comment out the qApp->exit(ExitHelperCode);. Does that have any effect on the "crash" you report? And btw how do you know your app was "crashing", given that it was supposed to exit?

                                    It all still boils down to whether that signal handler function is being hit at all when you press the "Stop" button from Creator.

                                    You might also try

                                    signal(SIGINT,  SIG_IGN);
                                    signal(SIGTERM, SIG_IGN);
                                    

                                    instead as your first two lines in main().

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      abarmotov
                                      wrote on last edited by
                                      #18
                                      1. yes , i saw "SIG = 15", then kill app from from console
                                      2. myapp was "crashing" - that qtcreator says in output window
                                      JonBJ andrA 2 Replies Last reply
                                      1
                                      • A abarmotov
                                        1. yes , i saw "SIG = 15", then kill app from from console
                                        2. myapp was "crashing" - that qtcreator says in output window
                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by JonB
                                        #19

                                        @abarmotov
                                        Yes, that's SIGTERM. I think you are saying it hit your printf("SIG = %i\n", sig); line, so we know it went into sighandler()? Then like I said try commenting out the qApp->exit(ExitHelperCode);, it may not be possible/safe to call that from within a signal handler.

                                        1 Reply Last reply
                                        0
                                        • A abarmotov
                                          1. yes , i saw "SIG = 15", then kill app from from console
                                          2. myapp was "crashing" - that qtcreator says in output window
                                          andrA Offline
                                          andrA Offline
                                          andr
                                          wrote on last edited by
                                          #20

                                          When trying to stop the application, the result is set to QProcess::CrashExit temporarily and updated whenever your process comes back with a proper exit. Your process doesn't come back with something better, so you get the "%1 crashed" response.

                                          I don't really see this as a bug, at best the exit code should perhaps be part of the message.

                                          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