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. My app crashes when trying to quit
Forum Updated to NodeBB v4.3 + New Features

My app crashes when trying to quit

Scheduled Pinned Locked Moved Solved General and Desktop
macoscrash appquitappcrash qtcreac++ qt
5 Posts 2 Posters 1.2k Views 1 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.
  • supergS Offline
    supergS Offline
    superg
    wrote on last edited by
    #1

    Hi, my app used to close properly but a few days back it started to crash when trying to quit.
    I can't find where's the mistake.
    Everything is OK until I call qApp->quit() (It happens also with QApplication::quit() and exit(1)).
    Here's what I see in my app Output:

    2022-12-15 16:38:29.252285-0300 ProyectoPola[49557:596442] [qt.core.library] "/Users/santiagocarlos/Qt/6.4.1/macos/plugins/imageformats/libqgif.dylib" unloaded library (faked)
    ProyectoPola(49557,0x100307dc0) malloc: *** error for object 0x101c07310: pointer being freed was not allocated
    ProyectoPola(49557,0x100307dc0) malloc: *** set a breakpoint in malloc_error_break to debug
    Detected Qt Version: 0x60401 (namespace='no namespace')
    Found function QObject::property: 0x1012372e0
    Found function QObject::customEvent: 0x10122f120
    

    When the crash happens, this is the first function that I see in the debugger that has a problem. It's in the qarraydata.h file, in the following function:

    static void deallocate(QArrayData *data) noexcept
        {
            static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData));
            QArrayData::deallocate(data, sizeof(T), alignof(AlignmentDummy));
        }
    
    

    All of this happens when I try to quit the app in my MainWindow. Here's the code for reference:

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        // Carga de logos.
        QPixmap logoBio(":/images/Resources/logobiotandil.png");
        ui->logoBio->setPixmap(logoBio);
        QPixmap nombreBio(":/images/Resources/logobiotandil2.png");
        ui->nombreBio->setPixmap(nombreBio);
        QPixmap nombreRed(":/images/Resources/redimecfondo.png");
        ui->redimec->setPixmap(nombreRed);
    
        // Cargo pantallas
    
    
    
        // Set connection to database
        /*
        db = QSqlDatabase::addDatabase("QMARIADB");
        db.setHostName("200.41.196.243");
        db.setPort(3307);
        db.setDatabaseName("polarimetro");
        db.setUserName("polarimetrolbt");
        db.setPassword("polarimetrolbt");
    
        qDebug() << "db connection on menu: " << db.open();*/
    
    }
    
    void MainWindow::on_offButton_clicked() {
        qApp->quit();
    }
    
    void MainWindow::on_onButton_clicked() {
        Menu* menuEnsayos = new Menu(this);
        ui->stackedWidget->addWidget(menuEnsayos);
        ui->stackedWidget->setCurrentWidget(menuEnsayos);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    

    I run the app and immediately push the "off button". I do not press the "on button" at all.

    Can anyone help me, please?
    Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Right now, I don't. I remember having that kind of stuff happening from time to time on Windows. I would just nuked the build folder and start fresh.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      supergS 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Which version of macOS are you using ?
        Which version of Xcode are you using ?
        Does it also happen if you implement that in a default application ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        supergS 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Which version of macOS are you using ?
          Which version of Xcode are you using ?
          Does it also happen if you implement that in a default application ?

          supergS Offline
          supergS Offline
          superg
          wrote on last edited by
          #3

          @SGaist Hi! I'm using MacOS Catalina 10.15.7 and the command line tools version 12.0.

          It's very weird, I just duplicated the project and run the app again, and works again. It might been a bug in the build folder, or something like that.

          Do you know what could throw that kind of error?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Right now, I don't. I remember having that kind of stuff happening from time to time on Windows. I would just nuked the build folder and start fresh.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            supergS 1 Reply Last reply
            0
            • SGaistS SGaist

              Right now, I don't. I remember having that kind of stuff happening from time to time on Windows. I would just nuked the build folder and start fresh.

              supergS Offline
              supergS Offline
              superg
              wrote on last edited by
              #5

              @SGaist That seems to be the solution, haha! Thanks.

              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