Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-88464

wasm: signal not emitted, maybe because of QSettings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.4.0
    • 5.15.1
    • Core: Object Model, QPA
    • None
    • Firefox, Chromium-Browser, Qt-5.15.1-wasm_32, Emscripten 1.39.8
    • WebAssembly

    Description

      With the WebAssembly version of my application, signals from widgets are sometimes not emitted. I've created a minimal example that reproduces the effect: there are two spin boxes, and when changing them, a label next to them should be updated. This works for one spin box, but not the other.

      Excerpt from the program (see attached zip for full version):

      Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) {
          ui->setupUi(this);
      
          // 1930 is the smallest number that makes the bug show up. Larger numbers
          // work too.
          for (int i = 0; i < 1930; ++i) {
              new QObject(this);
          }
      
          {
              QSettings s;
          }
      
          // This signal/slot connection never works
          connect(ui->spinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                  [&](int value) { ui->label->setText(QString::number(value)); });
      
          // This signal/slot connection does work
          connect(ui->spinBox_2, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                  [&](int value) { ui->label_2->setText(QString::number(value)); });
      }

      The program creates the widget with the spinboxes and labels, then it creates 1930 child QObjects, and creates and destroys a QSettings object before setting up the signal/slot connection for the spin boxes.

      The bug disappears when fewer than 1930 QObjects are created, when the QSettings object is not created, or is created using new, or when QApplication::setOrganizationDomain is not called.

      To compile the project, I used qmake and the default settings generated for me by QtCreator. The effective qmake call is:
      $HOME/Qt/5.15.1/wasm_32/bin/qmake $HOME/Projects/WasmQSpinboxBug2/WasmQSpinboxBug2.pro -spec wasm-emscripten CONFIG+=debug CONFIG+=qml_debug && /usr/bin/make qmake_all

      The code works fine compiled for native linux, so my guess is that QSettings for WebAssembly is misbehaving somehow.

      Attachments

        For Gerrit Dashboard: QTBUG-88464
        # Subject Branch Project Status CR V

        Activity

          People

            sorvig Morten Sørvig
            maxlor Benjamin Lutz
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change