For some time now I'm facing a very curious bug in my Qt app: after some time running, all the non-constantly updated parts of the app's interface just become black:
I'm in the dark here. This is not the first time this problem appeared and the last time (months ago) it went away in the same mysterious way it came. AFAIK there is simply no part of the 10k+ lines of code that would give any reason for this to happen, nor any of the recent changes could have touched in the painting of all the software's screens.
Relevant details:
- I'm using Qt 4.8 for Embedded Linux
- This occurs exporadically: sometimes it does, sometimes it doesn't.
- It's not hardware problem: I tested in different hardwares and it occurs in all of them.
- This occurs in just any screen/widget - it's not something exclusive of one of the screens in the system.
- Before the "black bug", the screens look normal: a label displays its text, a pixmap displays its pixmap, etc.. When the "black bug" appears all of this suddenly disappear and is replaced by pure black the only exception being the parts that move (thanks to a QTimer or something like that). See the image above and notice the black areas around the graph where there should be plenty of QPushButtons and QLabels.
- I'm using QtWidgets + custom widgets + custom painting in some parts, but this happens in all places as far as I can see. No OpenGL involved.
- The app has a basic QMainWindow over which lots of screens are displayed (most of which are already created only waiting for a
show()
command to appear). This bug can occur in all widgets as far as it seems. - About using something else, I only use Qwt and QwtPolar. No library for "advanced graphics plotting" is used.
- I can't say it is "100% reproducible" since it appears sporadically and there is not telling when and if it will appear. For example, we let it open running some tests last weekend and Monday the bug wasn't there, yet during the same Monday we caught the bug at least 3 times.
- I Haven't tried in anywhere but the target platform.
- No help found in Google so far
I tried to do some printscreens with the code:
QPixmap screenshotPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
const bool resp = screenshotPixmap.save(fileTemp.fileName(), "png", 90);
But the pixmap were OK: no black part. IOW although appearing for the user, the QPixmap::grabWindow
didn't "notice the bug" and correctly grabbed the windows.
It's worth remembering I'm not posting any code precisely because there is no specific known code relevant for this bug (and even if I could, the whole code wouldn't fit here nor is it open source!). Obviously then I don't expect some specific answer, but more like general hints from people that maybe already faced this in the pass or some general debugging tips (besides comparing files with version controller). As lost as I am with this one, any help would be appreciated.