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 Updated to NodeBB v4.3 + New Features

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.
  • 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
                                  • A Offline
                                    A Offline
                                    abarmotov
                                    wrote on last edited by
                                    #21

                                    hm, if qApp->exit(ExitHelperCode) is not the safe - that it should to be ?
                                    that code works fine before qtcreator v.7 and works fine in my app as ubuntu service

                                    JonBJ 1 Reply Last reply
                                    0
                                    • A abarmotov

                                      hm, if qApp->exit(ExitHelperCode) is not the safe - that it should to be ?
                                      that code works fine before qtcreator v.7 and works fine in my app as ubuntu service

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

                                      @abarmotov
                                      That is not the current question. The question is: does the crash, misbehaviour or whatever the issue is go away if you remove that line? By now you could have given us that answer :)

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

                                        @abarmotov said in qtcreator crashes stopping the application:

                                        if i remove qApp->exit, then:

                                        1. SIG = 15 and SIG = 2 printed IF i send that signals from console (or from kde task manager), but app continue working
                                        2. from creator "red" button crash my app still

                                        i will try to check this behavior on another machine from new user with clean configs ...

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

                                          fresh install on new user - same behavior
                                          so need to know which signal creator sends to app on press "red" button - KILL, TERM, INT ...

                                          JonBJ 2 Replies 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