QLabel::setText() on inactive window of Mac
-
Hi, this seems to be a bit of a tricky one. Problem observed on Qt 5.9, 5.12 and 5.15.
In the app I am debugging on Mac, there is a main app window, and a non-modal tabbed settings window in which there are some
QLabelitems that get regularly updated with data values (a couple of times a second).The problem is that if the settings window is displayed, but is not on top (the main app window is on top), and the user is not interacting with the program, the label updates result in steadily increasing memory usage. Then after some time (10 minutes or more), when the user next tries to interact with the program, the program goes busy (spinning ball) for a significant time before resuming. Once the program has resumed, the memory usage has gone down somewhat.
If the settings window is on top, the memory usage does not increase significantly.
It seems like there are objects being queued for deletion by the label updates, but that these deletions are only processed when the owning window is on top, and otherwise are queued for an event loop that doesn't run until the user interacts with the program again.
Is there a way to ensure these queued deletions get processed in the background as soon as they can be, rather than being queued up for a long time?
One further data item is that an older version of the program did not use a tabbed dialog for the settings window, just a simple dialog, and it doesn't suffer from this problem. It seems that maybe the tabbed dialog somehow gives rise to the issue.
This issue has only been observed on Mac, not on Windows or Linux.
-
Hi and welcome to devnet,
Can you provide a minimal compilable example that shows this behaviour ?
-
Hi and welcome to devnet,
Can you provide a minimal compilable example that shows this behaviour ?
@SGaist That would be a significant challenge. The program exhibiting the issue (Jamulus) is large and complex.
At this stage I was hoping to understand the principles involved with Qt, particularly how the event loop relates to a background window.
-
Is it hidden or just not active ?
One thing you can do is use GammaRay to check what is going on.