Results 1 to 4 of 4

Thread: QApplication hanging on poll() (sometimes)

  1. #1
    Join Date
    Dec 2019
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question QApplication hanging on poll() (sometimes)

    I'm having an intermittent issue where the following main.cpp will hang on the call to QApplication (int argc, char *argv[]) at a poll() call.
    I'm using Qt 5.1.1, g++ 4.8.5 and Eclipse 4.11.0 on RHEL 7.8.

    This is the simple main program that QtCreator created for me so I'm assuming that it is doing it as expected.
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "MyMainWindow.h"
    4.  
    5. int main (int argc, char *arg[])
    6. {
    7. QApplication a (argc, argv);
    8.  
    9. MyMainWindow w;
    10.  
    11. a.exec()
    12. }
    To copy to clipboard, switch view to plain text mode 

    I'm currently using Eclipse as my IDE and am using the .pro file from QtCreator and qmake to create a Makefile which I then compile with in Eclipse.

    My problem is that occasionally my program hangs and when I use the Eclipse debugger (gdb) to see where it's hanging up it's in a call to poll() . This means that it never leaves QApplication to start MyMainWindow.

    Like I said this only happens occasionally and sometimes I can just logoff and back on and it works. Rebooting the system always fixes it, but that's kind of exteme.

    Has anyone seen this before? It's very frustrating since I'm on a tight schedule and I can't reboot this system every time this happens.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QApplication hanging on poll() (sometimes)

    Where is the call to "w.show()" to actually put your main window up on screen?

    And isn't there a "kill" command in linux to stop a process? Rebooting your PC just to stop a program seems a little extreme.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Dec 2019
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QApplication hanging on poll() (sometimes)

    Quote Originally Posted by d_stranz View Post
    Where is the call to "w.show()" to actually put your main window up on screen?
    It's in MyMainWidow

    And isn't there a "kill" command in linux to stop a process? Rebooting your PC just to stop a program seems a little extreme.
    After I exit out of the Eclipse, there's noting to kill.
    Last edited by DesertBroncoFan; 12th August 2021 at 16:54. Reason: reformatted to look better

  4. #4
    Join Date
    Dec 2019
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QApplication hanging on poll() (sometimes)

    I'm still having this problem.

    Could it be a result of having Gnome 3 on my system (there are other problems with this on RHEL 7.8)?

Similar Threads

  1. Best Way to Poll for a Flag in Main Event Thread
    By leinad in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2020, 18:05
  2. Poll: what add-on libraries do you use ?
    By marcvanriet in forum Newbie
    Replies: 7
    Last Post: 14th October 2011, 07:05
  3. Poll: Windows IDE
    By magland in forum General Discussion
    Replies: 15
    Last Post: 18th July 2009, 12:09
  4. GLib-WARNING **: poll(2) failed due to: Invalid argument.
    By December in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2009, 06:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.