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

Spurious warning about not running on main thread

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.5.0
    • Core: Threads
    • None
    • windows

    Description

      Launching a second QApplication after the first one has completed produces a spurious warning about not running from the main thread, functionality appears correct.

      Would be cool if this didn't trigger a warning, right now the solution is to build custom version of qt...

      #include <QApplication>
      #include <thread>
      int main(int argc, char *argv[])
      {
      	auto gui_wapper = []{
      		int nope = 0;
      		QApplication a(nope, nullptr);
      		QMetaObject::invokeMethod(&a, "quit", Qt::QueuedConnection);
      		return a.exec();
      	};
      	std::thread t1(gui_wapper);
      	t1.join();//no spurious warnings, everything works as expected
      	std::thread t2(gui_wapper);
      	t2.join();//spurious warning, makes me look silly
      	return 0;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            kandel3 Mikhail Kandel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes