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. QMessageBox closes application
QtWS25 Last Chance

QMessageBox closes application

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpolygonconnectmousepressevent
35 Posts 7 Posters 7.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.
  • H hobbyProgrammer

    @jsulm it also stops whenever I save a file. The saving part works perfectly, but afterwards it just closes down the app and it seems to be the same mystery as the showContextMenu.
    I would like to think that it's the connect function, since they both use connect().
    However I've connected about 20 actions like this and only 2 seems to close the app. I would expect them all to close down the app if it were the connect() function.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #11

    @hobbyProgrammer As I said: connect() does not call the slots.
    Why don't you simply use debugger to see where exactly it crashes?

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

    H 1 Reply Last reply
    1
    • jsulmJ jsulm

      @hobbyProgrammer As I said: connect() does not call the slots.
      Why don't you simply use debugger to see where exactly it crashes?

      H Offline
      H Offline
      hobbyProgrammer
      wrote on last edited by
      #12

      @jsulm As I said:
      it closes/crashes in the qeventloop.cpp.

          while (!d->exit.loadAcquire())
              processEvents(flags | WaitForMoreEvents | EventLoopExec);
      

      But I have no clue how to prevent this

      JonBJ 1 Reply Last reply
      0
      • H hobbyProgrammer

        @jsulm As I said:
        it closes/crashes in the qeventloop.cpp.

            while (!d->exit.loadAcquire())
                processEvents(flags | WaitForMoreEvents | EventLoopExec);
        

        But I have no clue how to prevent this

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

        @hobbyProgrammer
        @jsulm will know better than I, but I wouldn't have thought connect() would even call processEvents()/the main event loop?

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hobbyProgrammer
          wrote on last edited by
          #14

          @jsulm @JonB Whenever I use the debugger I don't even get the showContexyMenu(), but when I don't open in debugger, I do get the contextMenu...

          jsulmJ 1 Reply Last reply
          0
          • H hobbyProgrammer

            @jsulm @JonB Whenever I use the debugger I don't even get the showContexyMenu(), but when I don't open in debugger, I do get the contextMenu...

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #15

            @hobbyProgrammer Does it crash if you do not connect the slot?
            And it would be helpful if you would post the stack trace after crash.

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

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #16

              @hobbyProgrammer said in connect() keeps crashing:

              Whenever I use the debugger I don't even get the showContexyMenu(),

              So what's the backtrace?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hobbyProgrammer
                wrote on last edited by hobbyProgrammer
                #17

                @jsulm @Christian-Ehrlicher

                I'm not really familliar with the debugger... Does this provide the information you need?

                70cbc7e0-a83b-464b-85d0-16d232d1b7e2-image.png

                jsulmJ 1 Reply Last reply
                0
                • H hobbyProgrammer

                  @jsulm @Christian-Ehrlicher

                  I'm not really familliar with the debugger... Does this provide the information you need?

                  70cbc7e0-a83b-464b-85d0-16d232d1b7e2-image.png

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #18

                  @hobbyProgrammer If you post screen shots you should at least make sure the function signature on the bottom-right side are readable...

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

                  H 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @hobbyProgrammer If you post screen shots you should at least make sure the function signature on the bottom-right side are readable...

                    H Offline
                    H Offline
                    hobbyProgrammer
                    wrote on last edited by
                    #19

                    @jsulm
                    is this better?
                    06faa0a2-725e-4ea8-9468-885d660f9c68-image.png

                    JonBJ 1 Reply Last reply
                    0
                    • H hobbyProgrammer

                      @jsulm
                      is this better?
                      06faa0a2-725e-4ea8-9468-885d660f9c68-image.png

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

                      @hobbyProgrammer
                      It would be better if we could read the full function signatures at the bottom right, instead of left-truncated! Can't you drag the column resizer so we can see the full function name? You can make columns like Condition or Ignore much smaller.

                      1 Reply Last reply
                      0
                      • H hobbyProgrammer

                        This post is deleted!

                        Pl45m4P Online
                        Pl45m4P Online
                        Pl45m4
                        wrote on last edited by Pl45m4
                        #21

                        @hobbyProgrammer said in connect() keeps crashing:

                        qv.at(i)

                        It looks like you've created your vector on stack. What exactly does your slot do? Which vars do you access / try to access there?
                        If the connection fails, you would get an explicit warning / error message (which is obviously not the case)

                        I'm sure, that it crashes because you did something wrong before or inside your slot function.


                        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                        ~E. W. Dijkstra

                        H 1 Reply Last reply
                        1
                        • Pl45m4P Pl45m4

                          @hobbyProgrammer said in connect() keeps crashing:

                          qv.at(i)

                          It looks like you've created your vector on stack. What exactly does your slot do? Which vars do you access / try to access there?
                          If the connection fails, you would get an explicit warning / error message (which is obviously not the case)

                          I'm sure, that it crashes because you did something wrong before or inside your slot function.

                          H Offline
                          H Offline
                          hobbyProgrammer
                          wrote on last edited by
                          #22

                          @Pl45m4 Hi, I've found why it closes the app (sort of).
                          I have a few screens before this one. After going through those screens, you'll end up at this screen.
                          Whenever I only open this screen, it works perfectly, but when I open the screen through a different screen, it closes after a certain action.
                          Those other screens are hidden whenever a new screen is shown.

                          I still don't know why it closes.

                          Pl45m4P 1 Reply Last reply
                          0
                          • H hobbyProgrammer

                            @Pl45m4 Hi, I've found why it closes the app (sort of).
                            I have a few screens before this one. After going through those screens, you'll end up at this screen.
                            Whenever I only open this screen, it works perfectly, but when I open the screen through a different screen, it closes after a certain action.
                            Those other screens are hidden whenever a new screen is shown.

                            I still don't know why it closes.

                            Pl45m4P Online
                            Pl45m4P Online
                            Pl45m4
                            wrote on last edited by
                            #23

                            @hobbyProgrammer said in connect() keeps crashing:

                            I've found why it closes the app (sort of).

                            @hobbyProgrammer said in connect() keeps crashing:

                            I still don't know why it closes

                            Hm.... :D

                            @hobbyProgrammer said in connect() keeps crashing:

                            I have a few screens before this one

                            What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?

                            YOU programmed it, so you must know (should know) best, WHAT you did ;-)
                            Anybody else can just guess, if you make vague descriptions...

                            What does the "crash" look like? Any exception / error message or is it just terminating your process?


                            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                            ~E. W. Dijkstra

                            H 2 Replies Last reply
                            2
                            • Pl45m4P Pl45m4

                              @hobbyProgrammer said in connect() keeps crashing:

                              I've found why it closes the app (sort of).

                              @hobbyProgrammer said in connect() keeps crashing:

                              I still don't know why it closes

                              Hm.... :D

                              @hobbyProgrammer said in connect() keeps crashing:

                              I have a few screens before this one

                              What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?

                              YOU programmed it, so you must know (should know) best, WHAT you did ;-)
                              Anybody else can just guess, if you make vague descriptions...

                              What does the "crash" look like? Any exception / error message or is it just terminating your process?

                              H Offline
                              H Offline
                              hobbyProgrammer
                              wrote on last edited by
                              #24

                              @Pl45m4 No there's a screen with a "start" button and when you press that button, the graphicsview screen shows up. When I remove that screen it works, but I need that screen/window for the end result.

                              The way I call a new screen is like this:

                              In the .h file:

                              #include "window.h"
                              
                              private:
                              Window *win;
                              

                              In the .cpp file:

                                      this->hide();                                                                                       //hides the current screen
                                      win = new Window(this);
                                      win->show();
                              
                              Pl45m4P 1 Reply Last reply
                              0
                              • Pl45m4P Pl45m4

                                @hobbyProgrammer said in connect() keeps crashing:

                                I've found why it closes the app (sort of).

                                @hobbyProgrammer said in connect() keeps crashing:

                                I still don't know why it closes

                                Hm.... :D

                                @hobbyProgrammer said in connect() keeps crashing:

                                I have a few screens before this one

                                What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?

                                YOU programmed it, so you must know (should know) best, WHAT you did ;-)
                                Anybody else can just guess, if you make vague descriptions...

                                What does the "crash" look like? Any exception / error message or is it just terminating your process?

                                H Offline
                                H Offline
                                hobbyProgrammer
                                wrote on last edited by
                                #25

                                @Pl45m4 Hi, the crash is not actually a crash. It's just the app that closes. It comes with an "exited with code 0"

                                1 Reply Last reply
                                0
                                • H hobbyProgrammer

                                  @Pl45m4 No there's a screen with a "start" button and when you press that button, the graphicsview screen shows up. When I remove that screen it works, but I need that screen/window for the end result.

                                  The way I call a new screen is like this:

                                  In the .h file:

                                  #include "window.h"
                                  
                                  private:
                                  Window *win;
                                  

                                  In the .cpp file:

                                          this->hide();                                                                                       //hides the current screen
                                          win = new Window(this);
                                          win->show();
                                  
                                  Pl45m4P Online
                                  Pl45m4P Online
                                  Pl45m4
                                  wrote on last edited by Pl45m4
                                  #26

                                  @hobbyProgrammer

                                  Using the correct Qt terminology would help too. Sure, it's a kind of "screen" what you see in from of you but if you write QDialog or `Q(Main-)Window, everybody can imagine what your program procedure looks like.

                                  @hobbyProgrammer said in connect() keeps crashing:

                                  The way I call a new screen is like this:
                                  In the .h file:
                                  #include "window.h"

                                  private:
                                  Window *win;

                                  In the .cpp file:
                                  this->hide(); //hides the current screen
                                  win = new Window(this);
                                  win->show();

                                  This doesn't seem to help for solving your problem ;-) It helps to understand what you are doing. Otherwise we get all the information in pieces and that makes it unnecessarily complicated...

                                  @hobbyProgrammer said in connect() keeps crashing:

                                  When I remove that screen it works

                                  "Remove screen" = Remove / comment the actual code
                                  or
                                  "remove" = dont open that result window?

                                  @hobbyProgrammer said in connect() keeps crashing:

                                  In the .cpp file:

                                          this->hide();
                                          // Check if it crashes / exits here
                                          win = new Window(this);
                                          win->show();
                                  

                                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                  ~E. W. Dijkstra

                                  H 2 Replies Last reply
                                  1
                                  • Pl45m4P Pl45m4

                                    @hobbyProgrammer

                                    Using the correct Qt terminology would help too. Sure, it's a kind of "screen" what you see in from of you but if you write QDialog or `Q(Main-)Window, everybody can imagine what your program procedure looks like.

                                    @hobbyProgrammer said in connect() keeps crashing:

                                    The way I call a new screen is like this:
                                    In the .h file:
                                    #include "window.h"

                                    private:
                                    Window *win;

                                    In the .cpp file:
                                    this->hide(); //hides the current screen
                                    win = new Window(this);
                                    win->show();

                                    This doesn't seem to help for solving your problem ;-) It helps to understand what you are doing. Otherwise we get all the information in pieces and that makes it unnecessarily complicated...

                                    @hobbyProgrammer said in connect() keeps crashing:

                                    When I remove that screen it works

                                    "Remove screen" = Remove / comment the actual code
                                    or
                                    "remove" = dont open that result window?

                                    @hobbyProgrammer said in connect() keeps crashing:

                                    In the .cpp file:

                                            this->hide();
                                            // Check if it crashes / exits here
                                            win = new Window(this);
                                            win->show();
                                    
                                    H Offline
                                    H Offline
                                    hobbyProgrammer
                                    wrote on last edited by
                                    #27

                                    @Pl45m4 said in connect() keeps crashing:

                                    "Remove screen" = Remove / comment the actual code
                                    or
                                    "remove" = dont open that result window?

                                    Don't open the window.
                                    Whenever I call that second window in the main.cpp it works fine, but when I call the first window in the main.cpp and call the second window in the first window, it has that problem of closing the app on certain actions.

                                    1 Reply Last reply
                                    0
                                    • Pl45m4P Pl45m4

                                      @hobbyProgrammer

                                      Using the correct Qt terminology would help too. Sure, it's a kind of "screen" what you see in from of you but if you write QDialog or `Q(Main-)Window, everybody can imagine what your program procedure looks like.

                                      @hobbyProgrammer said in connect() keeps crashing:

                                      The way I call a new screen is like this:
                                      In the .h file:
                                      #include "window.h"

                                      private:
                                      Window *win;

                                      In the .cpp file:
                                      this->hide(); //hides the current screen
                                      win = new Window(this);
                                      win->show();

                                      This doesn't seem to help for solving your problem ;-) It helps to understand what you are doing. Otherwise we get all the information in pieces and that makes it unnecessarily complicated...

                                      @hobbyProgrammer said in connect() keeps crashing:

                                      When I remove that screen it works

                                      "Remove screen" = Remove / comment the actual code
                                      or
                                      "remove" = dont open that result window?

                                      @hobbyProgrammer said in connect() keeps crashing:

                                      In the .cpp file:

                                              this->hide();
                                              // Check if it crashes / exits here
                                              win = new Window(this);
                                              win->show();
                                      
                                      H Offline
                                      H Offline
                                      hobbyProgrammer
                                      wrote on last edited by
                                      #28

                                      @Pl45m4 yes it seems to do that. Whenever I open it in the debugger, it gives a blank window with the title "mainwindow" , which is not the title the other window has. However, when I just run it (not in debugger mode) it opens the screen perfectly (apart from that it closes on some actions)

                                      1 Reply Last reply
                                      0
                                      • Christian EhrlicherC Offline
                                        Christian EhrlicherC Offline
                                        Christian Ehrlicher
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #29

                                        What Qt version do you use?

                                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                        Visit the Qt Academy at https://academy.qt.io/catalog

                                        H 1 Reply Last reply
                                        0
                                        • Christian EhrlicherC Christian Ehrlicher

                                          What Qt version do you use?

                                          H Offline
                                          H Offline
                                          hobbyProgrammer
                                          wrote on last edited by hobbyProgrammer
                                          #30

                                          @Christian-Ehrlicher 5.12.3. Would upgrading it to 5.13 help?

                                          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