Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.2, 6.5
-
None
-
M1 macOS 13.6.7
M1 macOS 14.4.1
Intel macOS 12.7.2
Description
I have been chasing down a bug in our application for a while.
We used to use several QOpenGLWidgets in different workspaces within our application.
We recently changed over to using QOpenGLWindow and embedding them with widget containers, for performance.
This has worked well, in general.
However, on macOS sometimes these QOpenGLWindow views just disappear, and you see whatever is underneath them instead. If you do something that triggers a repaint, the QOpenGLWindow content comes back.
I couldn't find any events in the program for repaint/update/anything that corresponded to when the QOpenGLWindow content would disappear.
Through some profiling I found that QFontCache::decreaseCache() and ~QCoreTextFontEngine() were called at the time the content disappeared. And even though it seems crazy (to me), this is somehow causing the issue.
If I exit early from QFontCache::decreaseCache, the issue doesn't happen. Or if I avoid drawing text in the QOpenGLWindow, the issue doesn't happen.
I have attached a minimal working sample that duplicates the issue. It creates two QOpenGLWindows and embeds them in a bigger view.
The QOpenGLWindow subclass draws text in several different fonts. This is necessary in order to trigger the font unloading that causes the issue.
If you run the program, the lower QOpenGLWindow will disappear in less than a minute. If you resize the window, it will appear again.