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. Crashes if close MainWindow
Forum Updated to NodeBB v4.3 + New Features

Crashes if close MainWindow

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 5 Posters 525 Views 2 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.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by JacobNovitsky
    #1

    Having a loop, open MainWindow window, if close window with x button getting programm crashed

    qtc.process_stub: Inferior error: QProcess::Crashed "Process crashed"
    Press <RETURN> to close this window...

    How to safe open and close main window?

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::on_pushButton_clicked()
    {
    
    
        secDialog = new SecDialog (this);
        secDialog -> show();
    
    }
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      If it crashes use a debugger to see where exactly it crashes. Then show us the code and we can say maybe more.

      J Offline
      J Offline
      JacobNovitsky
      wrote on last edited by
      #6

      @Christian-Ehrlicher it was problem in destructor, solved
      thanks :)

      1 Reply Last reply
      0
      • johngodJ Offline
        johngodJ Offline
        johngod
        wrote on last edited by
        #2

        Not sure if this will work, but:

        MainWindow::~MainWindow()
        {
            secDialog -> hide();
            delete secDialog;
            delete ui;
        }
        
        Pl45m4P J 2 Replies Last reply
        0
        • johngodJ johngod

          Not sure if this will work, but:

          MainWindow::~MainWindow()
          {
              secDialog -> hide();
              delete secDialog;
              delete ui;
          }
          
          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #3

          @johngod

          Not needed since MainWindow is parent of secDialog.


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

          ~E. W. Dijkstra

          1 Reply Last reply
          0
          • johngodJ johngod

            Not sure if this will work, but:

            MainWindow::~MainWindow()
            {
                secDialog -> hide();
                delete secDialog;
                delete ui;
            }
            
            J Offline
            J Offline
            JacobNovitsky
            wrote on last edited by
            #4

            @johngod does not help

            how to get to main loop? exit MainWindow maturely

            Christian EhrlicherC 1 Reply Last reply
            0
            • J JacobNovitsky

              @johngod does not help

              how to get to main loop? exit MainWindow maturely

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #5

              If it crashes use a debugger to see where exactly it crashes. Then show us the code and we can say maybe more.

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

              J 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                If it crashes use a debugger to see where exactly it crashes. Then show us the code and we can say maybe more.

                J Offline
                J Offline
                JacobNovitsky
                wrote on last edited by
                #6

                @Christian-Ehrlicher it was problem in destructor, solved
                thanks :)

                1 Reply Last reply
                0
                • J JacobNovitsky has marked this topic as solved on
                • C Offline
                  C Offline
                  CompSciDude
                  wrote on last edited by
                  #7

                  Crashes on exit are common if you do not have the parent-child hierarchy set up correctly.

                  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