Results 1 to 2 of 2

Thread: pyqt5 graphicsview app freezes intermittently

  1. #1
    Join Date
    Apr 2015
    Posts
    3
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default pyqt5 graphicsview app freezes intermittently

    I have an app that consists right now of a qgraphicsview and qgraphicsscene, and in it I draw some widgets (converted to qgraphicsitem via the usual proxy method), and some lines between the widgets. The creation of lines are initiated via queued signals from a backend QThread, the drawing is occuring in the main thread.

    Every few runs, the app freezes halfway through drawing the lines -- no crashes, or exception raised, just freezes, and Windows shows the "(not responding)" in window title. I have QTimers firing a "heartbeat" every second: one fires in main thread, one in thread that signals for line to be drawn, and one in a do-nothing (other than heartbeat) thread: all three stop firing, indicating all event loops are frozen, so I don't think it is a deadlock (I am not using any mutexes or thread synchro due to use of queued signals). Could it be deadlock due to 2 threads wanting Python's GIL? Any ideas what might be causing this? When the backend stuff runs in main thread, no issues.

    I trust that if connection is made between a signal in one thread and a slot in another, Qt automatically choose Qt.QueuedSignal as connection type, so although I know it would cause havoc if lines were being drawn in backend thread, I have not rigorously verified the draw indeed happens, how could it not? But how do you recommend I check this, compare currentThreadId with main thread ID? I can't find where to get the main thread id.
    Last edited by schollii; 13th April 2015 at 14:06.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: pyqt5 graphicsview app freezes intermittently

    The cross-thread signal/slot connection should indeed be handled as Qt::QueuedConnection unless you explicitly specify Qt:irectConnection.

    All threads' timers freezing does sound indeed like some global Python lock or similar interfering.

    Cheers,
    _

Similar Threads

  1. PyQt5 QPixmap
    By ChrisOfBristol in forum Newbie
    Replies: 4
    Last Post: 4th April 2015, 21:48
  2. QFileDialog freezes
    By FreddyKay in forum Qt Programming
    Replies: 4
    Last Post: 24th November 2014, 20:14
  3. QWebView: first XHR slow (GUI freezes)
    By yeikos in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2014, 10:53
  4. GUI freezes in loop: Thread does not help?
    By Matty23 in forum Qt Programming
    Replies: 4
    Last Post: 25th November 2010, 21:04
  5. Keyboards freezes
    By giusepped in forum Qt-based Software
    Replies: 0
    Last Post: 28th October 2008, 01:30

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.