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

QMessageBox closes application

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpolygonconnectmousepressevent
35 Posts 7 Posters 7.2k 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

    @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 Offline
    Pl45m4P Offline
    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 Offline
          Pl45m4P Offline
          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
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #31

                    So your connect does not crash - simply your mainwindow does not show up the contents again after hide/show. If so please upgrade to 5.12.5 (and update your thread title - it's completely confusing), there was a bug in the window handling code in 5.12.3 (afair fixed in 5.12.4).

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

                    H JonBJ 2 Replies Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      So your connect does not crash - simply your mainwindow does not show up the contents again after hide/show. If so please upgrade to 5.12.5 (and update your thread title - it's completely confusing), there was a bug in the window handling code in 5.12.3 (afair fixed in 5.12.4).

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

                      @Christian-Ehrlicher yes that seems to be the problem when I run it in debug mode, but when I run it normally it closes the second window after certain actions.
                      I'm currently upgrading it to 5.12.5, so hopefully this will solve the issue.

                      UPDATE: this did not work for the closing part, but it did resolve the thing in the debugger mode where I would just see a blank window.

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Christian Ehrlicher

                        So your connect does not crash - simply your mainwindow does not show up the contents again after hide/show. If so please upgrade to 5.12.5 (and update your thread title - it's completely confusing), there was a bug in the window handling code in 5.12.3 (afair fixed in 5.12.4).

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

                        @Christian-Ehrlicher said in connect() keeps crashing:

                        So your connect does not crash

                        @hobbyProgrammer
                        I don't understand this. You always said

                        connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&)));     
                        qDebug() << "it doesn't get here";  
                        

                        If the connect() does not crash, as it should not do, how come the debug message never showed up?

                        H 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @Christian-Ehrlicher said in connect() keeps crashing:

                          So your connect does not crash

                          @hobbyProgrammer
                          I don't understand this. You always said

                          connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&)));     
                          qDebug() << "it doesn't get here";  
                          

                          If the connect() does not crash, as it should not do, how come the debug message never showed up?

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

                          @JonB Hi, just a quick update. I think it does get there, but it prints this part before going executing the slot.

                          I managed to trace it down to the QEventLoop where it does something with the QMutexLocker and after that it goes to qcoreapplication.cpp where the function execCleanup is called and then it closes. I don't know much about debugging, nor do I have a lot of experience with Qt so I don't really know what this all means, but the function is executed and the line after the connect() is also printed.

                          JonBJ 1 Reply Last reply
                          0
                          • H hobbyProgrammer

                            @JonB Hi, just a quick update. I think it does get there, but it prints this part before going executing the slot.

                            I managed to trace it down to the QEventLoop where it does something with the QMutexLocker and after that it goes to qcoreapplication.cpp where the function execCleanup is called and then it closes. I don't know much about debugging, nor do I have a lot of experience with Qt so I don't really know what this all means, but the function is executed and the line after the connect() is also printed.

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

                            @hobbyProgrammer said in window closes after completing certain actions.:

                            @JonB Hi, just a quick update. I think it does get there, but it prints this part before going executing the slot.

                            It's really important for those who try to help you to give accurate description of what does/does not happen. Everyone was trying to figure how your connect() could not complete and get to the next line....

                            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