Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Threads in QApplication Issue with on Linux cross-compiled Qt v6.9.1
Forum Updated to NodeBB v4.3 + New Features

Threads in QApplication Issue with on Linux cross-compiled Qt v6.9.1

Scheduled Pinned Locked Moved Unsolved Qt 6
2 Posts 2 Posters 526 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.
  • A.v.OA Offline
    A.v.OA Offline
    A.v.O
    wrote on last edited by
    #1

    The Issue

    Context

    I've been building a docker image for my C++ Qt project which allows me to build the same Qt app for Linux x86_64, aarch64 and Windows x86_64. The image contains Wine to perform the same unittests for Windows as for the Linux build. The image is available from Docker Hub for v6.8.1 and for v6.9.1. The image contains 3 times the Qt framework for the different platforms.

    Thread Problem on Closing the QApplication

    What I found is that only the Windows build has one ore more threads hanging or being blocked from terminating making the application not exit. The following simple application just will not exit when the application is build using the Linux MinGW cross compiler on Ubuntu 24.04 which seems to be version 13.0.0.

    #include <QApplication>
    #include <QDebug>
    #include <QPushButton>
    
    int main(int argc, char* argv[])
    {
      int rv{0};
      QApplication app(argc, argv);
      QWidget* wgt = new QPushButton(QString(qVersion()) + "/" + QT_VERSION_STR);
      wgt->setWindowTitle("Qt Test Application");
      wgt->resize(300, 120);
      wgt->show();
      rv = app.exec();
      delete wgt;
      qDebug() << "Exiting with code:" << rv;
      return rv;
    }
    

    The problem threads are part of the by QApplication created pool of threads.
    Running the application on Windows or Linux using Wine has the same effect.
    When building the Qt framework from Windows using the MinGW version 13.2.0 does not cause the problem.

    QtCore Significant Changes v6.8 and v6.9

    On GitHub I saw development when comparing v6.8.1...v6.9.1 on a thread "Quality Of Service Level" and in Windows only file src/corelib/thread/qthread_win.cpp.

    Using Native Windows Build Framework (not possible)

    When compiling the Qt frame work using MinGW (13.2.0) natively on Windows is not possible due to
    bug 116159 in MinGW GCC.
    It should be possible to use an older GCC compiler using a newer libstdc++-6.dll library having backwards compatibility.
    That bug wil be resolved it seems in GCC version 13.4.

    Bad Workaround

    So for now I call std::exit(0) before the QApplication instance goes out of scope, only when compiling the Windows target, which is not a desirable solution. Another one is, canceling all threads except the main one which is also bad.

    QtBug Report

    I created a bug report QTBUG-139361 but I doubt it will be fixed at all.

    Question

    Is there someone also building the Windows Qt framework v6.9.x from source on Linux using a cross-compiler?
    If so do you have the same problem as described here when running my small application?

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

      So since it's a compiler bug - what should Qt do against it?

      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

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved